Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleans up warnings in jme3-desktop #2244

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jme3-desktop/src/main/java/com/jme3/app/AppletHarness.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static Applet getApplet(Application app){
return appToApplet.get(app);
}

@SuppressWarnings("unchecked")

private void createCanvas(){
AppSettings settings = new AppSettings(true);

Expand Down Expand Up @@ -107,7 +107,7 @@ private void createCanvas(){
JmeSystem.setLowPermissions(true);

try{
Class clazz = Class.forName(appClass);
Class<?> clazz = Class.forName(appClass);
app = (LegacyApplication) clazz.getDeclaredConstructor().newInstance();
} catch (ClassNotFoundException
| InstantiationException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
import java.awt.Component;

import com.jme3.app.Application;
import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager;
import com.jme3.system.AWTFrameProcessor;
import com.jme3.system.AWTTaskExecutor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ public JmeCursor load(AssetInfo info) throws IOException {
}
}


// @SuppressWarnings("resource")
private JmeCursor loadCursor(InputStream inStream) throws IOException {

byte[] icoimages = new byte[0]; // new byte [0] facilitates read()
Expand All @@ -107,7 +109,7 @@ private JmeCursor loadCursor(InputStream inStream) throws IOException {
int steps = 0;
int width = 0;
int height = 0;
int flag = 0; // we don't use that.
//int flag = 0; // we don't use that.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why comment out rather than delete?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good Question. I have no strong opinion on keeping the comment :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since everything's under source control, code should be commented out only if there's a plausible reason to un-comment it later. And that rationale only works if it's obvious to someone reading the code what effects un-commenting would have.

int[] rate = null;
int[] animSeq = null;
ArrayList<byte[]> icons;
Expand Down Expand Up @@ -135,7 +137,7 @@ private JmeCursor loadCursor(InputStream inStream) throws IOException {
height = leIn.readInt();
leIn.skipBytes(8);
jiffy = leIn.readInt();
flag = leIn.readInt();
leIn.readInt(); // flag
nextInt = leIn.readInt();
} else if (nextInt == 0x65746172) { // found a 'rate' of animation
// System.out.println("we have 'rate'.");
Expand Down Expand Up @@ -207,8 +209,10 @@ private JmeCursor loadCursor(InputStream inStream) throws IOException {
return setJmeCursor(ciDat);

} else if (riff == 0x58464952) {
((LittleEndien) leIn).close();
throw new IllegalArgumentException("Big-Endian RIFX is not supported. Sorry.");
} else {
((LittleEndien) leIn).close();
throw new IllegalArgumentException("Unknown format.");
}
} else if (isCur || isIco) {
Expand Down
2 changes: 0 additions & 2 deletions jme3-desktop/src/main/java/com/jme3/input/AWTInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
import java.util.Objects;

import com.jme3.app.Application;
import com.jme3.input.Input;
import com.jme3.input.RawInputListener;
import com.jme3.system.AWTContext;
import com.jme3.system.AWTTaskExecutor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,7 @@ public AWTComponentRenderer(Component destination, TransferMode transferMode, Fr
if (frameBuffer != null) {
this.frameBuffer = frameBuffer;
} else {
this.frameBuffer = new FrameBuffer(width, height, 1);
this.frameBuffer.setDepthBuffer(Image.Format.Depth);
this.frameBuffer.setColorBuffer(Image.Format.RGBA8);
this.frameBuffer.setSrgb(true);
this.frameBuffer = AWTUtils.getFrameBuffer(width, height, 1);
}

colorModel = ColorModel.getRGBdefault();
Expand All @@ -203,6 +200,7 @@ public AWTComponentRenderer(Component destination, TransferMode transferMode, Fr

}


/**
* Initialize the component renderer.
* @param renderer the JMonkey {@link Renderer renderer} to use.
Expand Down
Loading
Loading