I looked through the classes in sun.java2d and removed most warnings
there. That is, unused imports, @Override annotations, local variables
hiding fields, static field access through an instance, redundant casts
and maybe something else I forgot.
Find the patch attached.
/Roman
--
http://kennke.org/blog/
Index: j2se/src/share/classes/sun/java2d/SunGraphicsEnvironment.java
===================================================================
--- j2se/src/share/classes/sun/java2d/SunGraphicsEnvironment.java (Revision 254)
+++ j2se/src/share/classes/sun/java2d/SunGraphicsEnvironment.java (Arbeitskopie)
@@ -34,7 +34,6 @@
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.Toolkit;
-import java.awt.font.TextAttribute;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.File;
@@ -42,21 +41,15 @@
import java.io.FilenameFilter;
import java.io.InputStreamReader;
import java.io.IOException;
-import java.text.AttributedCharacterIterator;
import java.util.ArrayList;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Locale;
-import java.util.Map;
import java.util.NoSuchElementException;
-import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeMap;
-import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
-import sun.awt.AppContext;
import sun.awt.DisplayChangedListener;
import sun.awt.FontConfiguration;
import sun.awt.SunDisplayChanger;
@@ -133,6 +126,7 @@
static {
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
+ @Override
public Object run() {
jreLibDirName = System.getProperty("java.home","") +
@@ -162,6 +156,7 @@
public SunGraphicsEnvironment() {
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
+ @Override
public Object run() {
String osName = System.getProperty("os.name");
if ("Linux".equals(osName)) {
@@ -363,6 +358,7 @@
/**
* Returns an array of all of the screen devices.
*/
+ @Override
public synchronized GraphicsDevice[] getScreenDevices() {
GraphicsDevice[] ret = screens;
if (ret == null) {
@@ -382,6 +378,7 @@
/**
* Returns the default screen graphics device.
*/
+ @Override
public GraphicsDevice getDefaultScreenDevice() {
return getScreenDevices()[0];
}
@@ -391,6 +388,7 @@
* given BufferedImage.
* @throws NullPointerException if BufferedImage argument is null
*/
+ @Override
public Graphics2D createGraphics(BufferedImage img) {
if (img == null) {
throw new NullPointerException("BufferedImage cannot be null");
@@ -417,7 +415,7 @@
if (platformFontDirs == null) {
String path = getPlatformFontPath(noType1Font);
StringTokenizer parser =
- new StringTokenizer(path, File.pathSeparator);;
+ new StringTokenizer(path, File.pathSeparator);
ArrayList<String> pathList = new ArrayList<String>();
try {
while (parser.hasMoreTokens()) {
@@ -469,6 +467,7 @@
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
+ @Override
public Object run() {
if (fontPath == null) {
fontPath = getPlatformFontPath(noType1Font);
@@ -507,6 +506,7 @@
}
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
+ @Override
public Object run() {
if (fontPath == null) {
fontPath = getPlatformFontPath(noType1Font);
@@ -610,6 +610,7 @@
/**
* Returns all fonts available in this environment.
*/
+ @Override
public Font[] getAllFonts() {
Font[] installedFonts = getAllInstalledFonts();
Font[] created = FontManager.getCreatedFonts();
@@ -640,6 +641,7 @@
systemLocale = (Locale)
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
+ @Override
public Object run() {
/* On windows the system locale may be different than the
* user locale. This is an unsupported configuration, but
@@ -732,7 +734,7 @@
String[] retval = new String[familyNames.size()];
Object [] keyNames = familyNames.keySet().toArray();
for (int i=0; i < keyNames.length; i++) {
- retval[i] = (String)familyNames.get(keyNames[i]);
+ retval[i] = familyNames.get(keyNames[i]);
}
if (requestedLocale.equals(Locale.getDefault())) {
lastDefaultLocale = requestedLocale;
@@ -742,6 +744,7 @@
return retval;
}
+ @Override
public String[] getAvailableFontFamilyNames(Locale requestedLocale) {
String[] installed = getInstalledFontFamilyNames(requestedLocale);
/* Use a new TreeMap as used in getInstalledFontFamilyNames
@@ -769,6 +772,7 @@
}
}
+ @Override
public String[] getAvailableFontFamilyNames() {
return getAvailableFontFamilyNames(Locale.getDefault());
}
@@ -784,6 +788,7 @@
}
public static class TTFilter implements FilenameFilter {
+ @Override
public boolean accept(File dir,String name) {
/* all conveniently have the same suffix length */
int offset = name.length()-4;
@@ -799,6 +804,7 @@
}
public static class T1Filter implements FilenameFilter {
+ @Override
public boolean accept(File dir,String name) {
if (noType1Font) {
return false;
@@ -817,6 +823,7 @@
}
public static class TTorT1Filter implements FilenameFilter {
+ @Override
public boolean accept(File dir, String name) {
/* all conveniently have the same suffix length */
@@ -874,6 +881,7 @@
public void register1dot0Fonts() {
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
+ @Override
public Object run() {
String type1Dir = "/usr/openwin/lib/X11/fonts/Type1";
registerFontsInDir(type1Dir, true, Font2D.TYPE1_RANK,
@@ -1232,9 +1240,9 @@
boolean preferLocale,
boolean preferProportional) {
- FontConfiguration fontConfig =
+ FontConfiguration _fontConfig =
createFontConfiguration(preferLocale, preferProportional);
- initCompositeFonts(fontConfig, altNameCache);
+ initCompositeFonts(_fontConfig, altNameCache);
}
/* If (as we do on X11) need to set a platform font path,
@@ -1250,6 +1258,7 @@
* From the DisplayChangedListener interface; called
* when the display mode has been changed.
*/
+ @Override
public void displayChanged() {
// notify screens in device array to do display update stuff
for (GraphicsDevice gd : getScreenDevices()) {
@@ -1267,6 +1276,7 @@
* Part of the DisplayChangedListener interface:
* propagate this event to listeners
*/
+ @Override
public void paletteChanged() {
displayChanger.notifyPaletteChanged();
}
Index: j2se/src/share/classes/sun/java2d/SunGraphics2D.java
===================================================================
--- j2se/src/share/classes/sun/java2d/SunGraphics2D.java (Revision 254)
+++ j2se/src/share/classes/sun/java2d/SunGraphics2D.java (Arbeitskopie)
@@ -41,24 +41,17 @@
import java.awt.image.renderable.RenderContext;
import java.awt.image.AffineTransformOp;
import java.awt.image.Raster;
-import java.awt.image.SampleModel;
-import java.awt.image.VolatileImage;
import java.awt.image.WritableRaster;
import java.awt.Image;
import java.awt.Composite;
import java.awt.Color;
-import java.awt.color.ColorSpace;
-import java.awt.image.DataBuffer;
import java.awt.image.ColorModel;
-import java.awt.image.IndexColorModel;
-import java.awt.image.DirectColorModel;
import java.awt.GraphicsConfiguration;
import java.awt.Paint;
import java.awt.GradientPaint;
import java.awt.LinearGradientPaint;
import java.awt.RadialGradientPaint;
import java.awt.TexturePaint;
-import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
import java.awt.geom.PathIterator;
import java.awt.geom.GeneralPath;
@@ -69,19 +62,16 @@
import java.text.AttributedCharacterIterator;
import java.awt.Font;
import java.awt.image.ImageObserver;
-import java.awt.image.ColorConvertOp;
import java.awt.Transparency;
import java.awt.font.GlyphVector;
import java.awt.font.TextLayout;
import sun.font.FontDesignMetrics;
-import sun.font.StandardGlyphVector;
import sun.java2d.pipe.PixelDrawPipe;
import sun.java2d.pipe.PixelFillPipe;
import sun.java2d.pipe.ShapeDrawPipe;
import sun.java2d.pipe.ValidatePipe;
import sun.java2d.pipe.ShapeSpanIterator;
import sun.java2d.pipe.Region;
-import sun.java2d.pipe.RegionIterator;
import sun.java2d.pipe.TextPipe;
import sun.java2d.pipe.DrawImagePipe;
import sun.java2d.pipe.LoopPipe;
@@ -90,7 +80,6 @@
import sun.java2d.loops.CompositeType;
import sun.java2d.loops.SurfaceType;
import sun.java2d.loops.Blit;
-import sun.java2d.loops.BlitBg;
import sun.java2d.loops.MaskFill;
import sun.font.FontManager;
import java.awt.font.FontRenderContext;
@@ -99,7 +88,6 @@
import sun.awt.SunHints;
import java.util.Map;
import java.util.Iterator;
-import sun.awt.image.OffScreenImage;
import sun.misc.PerformanceLogger;
/**
@@ -273,6 +261,7 @@
invalidatePipe();
}
+ @Override
protected Object clone() {
try {
SunGraphics2D g = (SunGraphics2D) super.clone();
@@ -308,6 +297,7 @@
/**
* Create a new SunGraphics2D based on this one.
*/
+ @Override
public Graphics create() {
return (Graphics) clone();
}
@@ -338,6 +328,7 @@
* @exception IllegalStateException If the Graphics
* to be constrained has a complex transform.
*/
+ @Override
public void constrain(int x, int y, int w, int h) {
if ((x|y) != 0) {
translate(x, y);
@@ -499,6 +490,7 @@
return clipRegion;
}
+ @Override
public Font getFont() {
if (font == null) {
font = defaultFont;
@@ -783,6 +775,7 @@
}
}
+ @Override
public FontMetrics getFontMetrics() {
if (this.fontMetrics != null) {
return this.fontMetrics;
@@ -792,6 +785,7 @@
FontDesignMetrics.getMetrics(font, getFontRenderContext());
}
+ @Override
public FontMetrics getFontMetrics(Font font) {
if ((this.fontMetrics != null) && (font == this.font)) {
return this.fontMetrics;
@@ -822,6 +816,7 @@
* @see #clip
* @see #setClip
*/
+ @Override
public boolean hit(Rectangle rect, Shape s, boolean onStroke) {
if (onStroke) {
s = stroke.createStrokedShape(s);
@@ -846,6 +841,7 @@
/**
* Return the device configuration associated with this Graphics2D.
*/
+ @Override
public GraphicsConfiguration getDeviceConfiguration() {
return surfaceData.getDeviceConfiguration();
}
@@ -868,6 +864,7 @@
* @see java.awt.Graphics#setPaintMode
* @see AlphaComposite
*/
+ @Override
public void setComposite(Composite comp) {
if (composite == comp) {
return;
@@ -930,6 +927,7 @@
* @see GradientPaint
* @see TexturePaint
*/
+ @Override
public void setPaint(Paint paint) {
if (paint instanceof Color) {
setColor((Color) paint);
@@ -1087,6 +1085,7 @@
* the rendering process.
* @see BasicStroke
*/
+ @Override
public void setStroke(Stroke s) {
if (s == null) {
throw new IllegalArgumentException("null Stroke");
@@ -1114,6 +1113,7 @@
* class.
* @see RenderingHints
*/
+ @Override
public void setRenderingHint(Key hintKey, Object hintValue) {
// If we recognize the key, we must recognize the value
// otherwise throw an IllegalArgumentException
@@ -1233,6 +1233,7 @@
* are defined in the RenderingHints class.
* @see RenderingHints
*/
+ @Override
public Object getRenderingHint(Key hintKey) {
if (hints != null) {
return hints.get(hintKey);
@@ -1280,6 +1281,7 @@
* @param hints The rendering hints to be set
* @see RenderingHints
*/
+ @Override
public void setRenderingHints(Map<?,?> hints) {
this.hints = null;
renderHint = SunHints.INTVAL_RENDER_DEFAULT;
@@ -1319,6 +1321,7 @@
* @param hints The rendering hints to be set
* @see RenderingHints
*/
+ @Override
public void addRenderingHints(Map<?,?> hints) {
boolean customHintPresent = false;
Iterator iter = hints.keySet().iterator();
@@ -1352,6 +1355,7 @@
* overall time/quality trade-off in the rendering process.
* @see RenderingHints
*/
+ @Override
public RenderingHints getRenderingHints() {
if (hints == null) {
return makeHints(null);
@@ -1411,6 +1415,7 @@
* [ 0 0 1 ]
* </pre>
*/
+ @Override
public void translate(double tx, double ty) {
transform.translate(tx, ty);
invalidateTransform();
@@ -1430,6 +1435,7 @@
* x axis toward the positive y axis.
* @param theta The angle of rotation in radians.
*/
+ @Override
public void rotate(double theta) {
transform.rotate(theta);
invalidateTransform();
@@ -1450,6 +1456,7 @@
* @param x The x coordinate of the origin of the rotation
* @param y The x coordinate of the origin of the rotation
*/
+ @Override
public void rotate(double theta, double x, double y) {
transform.rotate(theta, x, y);
invalidateTransform();
@@ -1466,6 +1473,7 @@
* [ 0 0 1 ]
* </pre>
*/
+ @Override
public void scale(double sx, double sy) {
transform.scale(sx, sy);
invalidateTransform();
@@ -1486,6 +1494,7 @@
* @param shy The factor by which coordinates are shifted towards the
* positive Y axis direction according to their X coordinate
*/
+ @Override
public void shear(double shx, double shy) {
transform.shear(shx, shy);
invalidateTransform();
@@ -1508,6 +1517,7 @@
* @see #setTransform
* @see AffineTransform
*/
+ @Override
public void transform(AffineTransform xform) {
this.transform.concatenate(xform);
invalidateTransform();
@@ -1516,6 +1526,7 @@
/**
* Translate
*/
+ @Override
public void translate(int x, int y) {
transform.translate(x, y);
if (transformState <= TRANSFORM_INT_TRANSLATE) {
@@ -1535,6 +1546,7 @@
* @see TransformChain
* @see AffineTransform
*/
+ @Override
public void setTransform(AffineTransform Tx) {
if ((constrainX|constrainY) == 0) {
transform.setTransform(Tx);
@@ -1597,6 +1609,7 @@
* @see #transform
* @see #setTransform
*/
+ @Override
public AffineTransform getTransform() {
if ((constrainX|constrainY) == 0) {
return new AffineTransform(transform);
@@ -1620,6 +1633,7 @@
* @see #setPaint
* @see java.awt.Graphics#setColor
*/
+ @Override
public Paint getPaint() {
return paint;
}
@@ -1628,10 +1642,12 @@
* Returns the current Composite in the Graphics2D state.
* @see #setComposite
*/
+ @Override
public Composite getComposite() {
return composite;
}
+ @Override
public Color getColor() {
return foregroundColor;
}
@@ -1657,24 +1673,25 @@
* though nothing bad will happen if it is run in other states.
*/
final void validateColor() {
- int eargb;
+ int _eargb;
if (imageComp == CompositeType.Clear) {
- eargb = 0;
+ _eargb = 0;
} else {
- eargb = foregroundColor.getRGB();
+ _eargb = foregroundColor.getRGB();
if (compositeState <= COMP_ALPHA &&
imageComp != CompositeType.SrcNoEa &&
imageComp != CompositeType.SrcOverNoEa)
{
AlphaComposite alphacomp = (AlphaComposite) composite;
- int a = Math.round(alphacomp.getAlpha() * (eargb >>> 24));
- eargb = (eargb & 0x00ffffff) | (a << 24);
+ int a = Math.round(alphacomp.getAlpha() * (_eargb >>> 24));
+ _eargb = (_eargb & 0x00ffffff) | (a << 24);
}
}
- this.eargb = eargb;
- this.pixel = surfaceData.pixelFor(eargb);
+ this.eargb = _eargb;
+ this.pixel = surfaceData.pixelFor(_eargb);
}
+ @Override
public void setColor(Color color) {
if (color == null || color == paint) {
return;
@@ -1716,6 +1733,7 @@
* @see getBackground
* @see Graphics.clearRect()
*/
+ @Override
public void setBackground(Color color) {
backgroundColor = color;
}
@@ -1724,6 +1742,7 @@
* Returns the background color used for clearing a region.
* @see setBackground
*/
+ @Override
public Color getBackground() {
return backgroundColor;
}
@@ -1732,10 +1751,12 @@
* Returns the current Stroke in the Graphics2D state.
* @see setStroke
*/
+ @Override
public Stroke getStroke() {
return stroke;
}
+ @Override
public Rectangle getClipBounds() {
Rectangle r;
if (clipState == CLIP_DEVICE) {
@@ -1753,6 +1774,7 @@
return r;
}
+ @Override
public Rectangle getClipBounds(Rectangle r) {
if (clipState != CLIP_DEVICE) {
if (transformState <= TRANSFORM_INT_TRANSLATE) {
@@ -1771,6 +1793,7 @@
return r;
}
+ @Override
public boolean hitClip(int x, int y, int width, int height) {
if (width <= 0 || height <= 0) {
return false;
@@ -1946,18 +1969,22 @@
return tx.createTransformedShape(clip);
}
+ @Override
public void clipRect(int x, int y, int w, int h) {
clip(new Rectangle(x, y, w, h));
}
+ @Override
public void setClip(int x, int y, int w, int h) {
setClip(new Rectangle(x, y, w, h));
}
+ @Override
public Shape getClip() {
return untransformShape(usrClip);
}
+ @Override
public void setClip(Shape sh) {
usrClip = transformShape(sh);
validateCompClip();
@@ -1971,6 +1998,7 @@
* current clip smaller. To make the clip larger, use any setClip method.
* @param p The Path to be intersected with the current clip.
*/
+ @Override
public void clip(Shape s) {
s = transformShape(s);
if (usrClip != null) {
@@ -1980,10 +2008,12 @@
validateCompClip();
}
+ @Override
public void setPaintMode() {
setComposite(AlphaComposite.SrcOver);
}
+ @Override
public void setXORMode(Color c) {
if (c == null) {
throw new IllegalArgumentException("null XORColor");
@@ -1994,6 +2024,7 @@
Blit lastCAblit;
Composite lastCAcomp;
+ @Override
public void copyArea(int x, int y, int w, int h, int dx, int dy) {
try {
doCopyArea(x, y, w, h, dx, dy);
@@ -2126,6 +2157,7 @@
}
*/
+ @Override
public void drawLine(int x1, int y1, int x2, int y2) {
try {
drawpipe.drawLine(this, x1, y1, x2, y2);
@@ -2143,6 +2175,7 @@
}
}
+ @Override
public void drawRoundRect(int x, int y, int w, int h, int arcW, int arcH) {
try {
drawpipe.drawRoundRect(this, x, y, w, h, arcW, arcH);
@@ -2160,6 +2193,7 @@
}
}
+ @Override
public void fillRoundRect(int x, int y, int w, int h, int arcW, int arcH) {
try {
fillpipe.fillRoundRect(this, x, y, w, h, arcW, arcH);
@@ -2177,6 +2211,7 @@
}
}
+ @Override
public void drawOval(int x, int y, int w, int h) {
try {
drawpipe.drawOval(this, x, y, w, h);
@@ -2194,6 +2229,7 @@
}
}
+ @Override
public void fillOval(int x, int y, int w, int h) {
try {
fillpipe.fillOval(this, x, y, w, h);
@@ -2211,6 +2247,7 @@
}
}
+ @Override
public void drawArc(int x, int y, int w, int h,
int startAngl, int arcAngl) {
try {
@@ -2229,6 +2266,7 @@
}
}
+ @Override
public void fillArc(int x, int y, int w, int h,
int startAngl, int arcAngl) {
try {
@@ -2247,6 +2285,7 @@
}
}
+ @Override
public void drawPolyline(int xPoints[], int yPoints[], int nPoints) {
try {
drawpipe.drawPolyline(this, xPoints, yPoints, nPoints);
@@ -2264,6 +2303,7 @@
}
}
+ @Override
public void drawPolygon(int xPoints[], int yPoints[], int nPoints) {
try {
drawpipe.drawPolygon(this, xPoints, yPoints, nPoints);
@@ -2281,6 +2321,7 @@
}
}
+ @Override
public void fillPolygon(int xPoints[], int yPoints[], int nPoints) {
try {
fillpipe.fillPolygon(this, xPoints, yPoints, nPoints);
@@ -2298,6 +2339,7 @@
}
}
+ @Override
public void drawRect (int x, int y, int w, int h) {
try {
drawpipe.drawRect(this, x, y, w, h);
@@ -2315,6 +2357,7 @@
}
}
+ @Override
public void fillRect (int x, int y, int w, int h) {
try {
fillpipe.fillRect(this, x, y, w, h);
@@ -2361,6 +2404,7 @@
}
}
+ @Override
public void clearRect(int x, int y, int w, int h) {
// REMIND: has some "interesting" consequences if threads are
// not synchronized
@@ -2388,6 +2432,7 @@
* @see #setClip
* @see #setComposite
*/
+ @Override
public void draw(Shape s) {
try {
shapepipe.draw(this, s);
@@ -2418,6 +2463,7 @@
* @see #clip
* @see #setClip
*/
+ @Override
public void fill(Shape s) {
try {
shapepipe.fill(this, s);
@@ -2546,6 +2592,7 @@
* @see #clip
* @see #setClip
*/
+ @Override
public void drawRenderedImage(RenderedImage img,
AffineTransform xform) {
@@ -2759,6 +2806,7 @@
}
}
+ @Override
public void drawRenderableImage(RenderableImage img,
AffineTransform xform) {
@@ -2800,6 +2848,7 @@
}
// text rendering methods
+ @Override
public void drawString(String str, int x, int y) {
if (str == null) {
throw new NullPointerException("String is null");
@@ -2826,6 +2875,7 @@
}
}
+ @Override
public void drawString(String str, float x, float y) {
if (str == null) {
throw new NullPointerException("String is null");
@@ -2852,6 +2902,7 @@
}
}
+ @Override
public void drawString(AttributedCharacterIterator iterator,
int x, int y) {
if (iterator == null) {
@@ -2861,6 +2912,7 @@
tl.draw(this, (float) x, (float) y);
}
+ @Override
public void drawString(AttributedCharacterIterator iterator,
float x, float y) {
if (iterator == null) {
@@ -2870,6 +2922,7 @@
tl.draw(this, x, y);
}
+ @Override
public void drawGlyphVector(GlyphVector gv, float x, float y)
{
if (gv == null) {
@@ -2892,6 +2945,7 @@
}
}
+ @Override
public void drawChars(char data[], int offset, int length, int x, int y) {
if (data == null) {
@@ -2922,6 +2976,7 @@
}
}
+ @Override
public void drawBytes(byte data[], int offset, int length, int x, int y) {
if (data == null) {
throw new NullPointerException("byte data is null");
@@ -2961,6 +3016,7 @@
* Draws an image scaled to x,y,w,h in nonblocking mode with a
* callback object.
*/
+ @Override
public boolean drawImage(Image img, int x, int y, int width, int height,
ImageObserver observer) {
return drawImage(img, x, y, width, height, null, observer);
@@ -2999,6 +3055,7 @@
* Draws an image scaled to x,y,w,h in nonblocking mode with a
* solid background color and a callback object.
*/
+ @Override
public boolean drawImage(Image img, int x, int y, int width, int height,
Color bg, ImageObserver observer) {
@@ -3035,6 +3092,7 @@
/**
* Draws an image at x,y in nonblocking mode.
*/
+ @Override
public boolean drawImage(Image img, int x, int y, ImageObserver observer) {
return drawImage(img, x, y, null, observer);
}
@@ -3043,6 +3101,7 @@
* Draws an image at x,y in nonblocking mode with a solid background
* color and a callback object.
*/
+ @Override
public boolean drawImage(Image img, int x, int y, Color bg,
ImageObserver observer) {
@@ -3071,6 +3130,7 @@
* Draws a subrectangle of an image scaled to a destination rectangle
* in nonblocking mode with a callback object.
*/
+ @Override
public boolean drawImage(Image img,
int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2,
@@ -3083,6 +3143,7 @@
* Draws a subrectangle of an image scaled to a destination rectangle in
* nonblocking mode with a solid background color and a callback object.
*/
+ @Override
public boolean drawImage(Image img,
int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2,
@@ -3164,6 +3225,7 @@
* @see #setComposite
* @see #setClip
*/
+ @Override
public boolean drawImage(Image img,
AffineTransform xform,
ImageObserver observer) {
@@ -3193,6 +3255,7 @@
}
}
+ @Override
public void drawImage(BufferedImage bImg,
BufferedImageOp op,
int x,
@@ -3222,6 +3285,7 @@
* Get the rendering context of the font
* within this Graphics2D context.
*/
+ @Override
public FontRenderContext getFontRenderContext() {
if (cachedFRC == null) {
int aahint = textAntialiasHint;
@@ -3261,6 +3325,7 @@
* other, less forgiving, VMs that really need to dispose of
* resources.
*/
+ @Override
public void dispose() {
surfaceData = NullSurfaceData.theInstance;
invalidatePipe();
@@ -3277,6 +3342,7 @@
* enough to know that if our override is empty then it should not
* mark us as finalizeable.
*/
+ @Override
public void finalize() {
// DO NOT REMOVE THIS METHOD
}
Index: j2se/src/share/classes/sun/java2d/NullSurfaceData.java
===================================================================
--- j2se/src/share/classes/sun/java2d/NullSurfaceData.java (Revision 254)
+++ j2se/src/share/classes/sun/java2d/NullSurfaceData.java (Arbeitskopie)
@@ -51,6 +51,7 @@
* objects must get a new SurfaceData object via the refresh method
* and revalidate their pipelines before continuing.
*/
+ @Override
public void invalidate() {
}
@@ -59,12 +60,14 @@
* of the destination that this SurfaceData object describes.
* This method is typically called when the SurfaceData is invalidated.
*/
+ @Override
public SurfaceData getReplacement() {
return this;
}
private final static NullPipe nullpipe = new NullPipe();
+ @Override
public void validatePipe(SunGraphics2D sg2d) {
sg2d.drawpipe = nullpipe;
sg2d.fillpipe = nullpipe;
@@ -73,6 +76,7 @@
sg2d.imagepipe = nullpipe;
}
+ @Override
public GraphicsConfiguration getDeviceConfiguration() {
return null;
}
@@ -88,6 +92,7 @@
*
* @see useTightBBoxes
*/
+ @Override
public Raster getRaster(int x, int y, int w, int h) {
throw new InvalidPipeException("should be NOP");
}
@@ -103,6 +108,7 @@
*
* @see getRaster
*/
+ @Override
public boolean useTightBBoxes() {
return false;
}
@@ -111,6 +117,7 @@
* Returns the pixel data for the specified Argb value packed
* into an integer for easy storage and conveyance.
*/
+ @Override
public int pixelFor(int rgb) {
return rgb;
}
@@ -119,6 +126,7 @@
* Returns the Argb representation for the specified integer value
* which is packed in the format of the associated ColorModel.
*/
+ @Override
public int rgbFor(int pixel) {
return pixel;
}
@@ -126,6 +134,7 @@
/**
* Returns the bounds of the destination surface.
*/
+ @Override
public Rectangle getBounds() {
return new Rectangle();
}
@@ -135,6 +144,7 @@
* Composite object should be allowed access to the pixels
* of this surface.
*/
+ @Override
protected void checkCustomComposite() {
return;
}
@@ -144,6 +154,7 @@
* false if there is no algorithm to perform the copyarea
* given the current settings of the SunGraphics2D.
*/
+ @Override
public boolean copyArea(SunGraphics2D sg2d,
int x, int y, int w, int h, int dx, int dy)
{
@@ -153,6 +164,7 @@
/**
* Returns destination Image associated with this SurfaceData (null)
*/
+ @Override
public Object getDestination() {
return null;
}
Index: j2se/src/share/classes/sun/java2d/SurfaceData.java
===================================================================
--- j2se/src/share/classes/sun/java2d/SurfaceData.java (Revision 254)
+++ j2se/src/share/classes/sun/java2d/SurfaceData.java (Arbeitskopie)
@@ -46,7 +46,6 @@
import sun.java2d.loops.DrawPath;
import sun.java2d.loops.FillPath;
import sun.java2d.loops.FillSpans;
-import sun.java2d.loops.FontInfo;
import sun.java2d.loops.DrawGlyphList;
import sun.java2d.loops.DrawGlyphListAA;
import sun.java2d.loops.DrawGlyphListLCD;
@@ -277,10 +276,12 @@
return sMgr.restoreContents();
}
+ @Override
public State getState() {
return stateDelegate.getState();
}
+ @Override
public StateTracker getStateTracker() {
return stateDelegate.getStateTracker();
}
@@ -313,6 +314,7 @@
return valid;
}
+ @Override
public Object getDisposerReferent() {
return disposerReferent;
}
@@ -465,8 +467,8 @@
public void validatePipe(SunGraphics2D sg2d) {
sg2d.imagepipe = imagepipe;
- if (sg2d.compositeState == sg2d.COMP_XOR) {
- if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR) {
+ if (sg2d.compositeState == SunGraphics2D.COMP_XOR) {
+ if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) {
sg2d.drawpipe = paintViaShape;
sg2d.fillpipe = paintViaShape;
sg2d.shapepipe = paintShape;
@@ -478,7 +480,7 @@
// text drawn in XOR mode with a Paint object.
sg2d.textpipe = outlineTextRenderer;
} else {
- if (sg2d.clipState == sg2d.CLIP_SHAPE) {
+ if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
sg2d.drawpipe = colorViaShape;
sg2d.fillpipe = colorViaShape;
// REMIND: We should not be changing text strategies
@@ -491,11 +493,11 @@
// which is not defined for XOR.
sg2d.textpipe = outlineTextRenderer;
} else {
- if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) {
+ if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
sg2d.drawpipe = colorViaShape;
sg2d.fillpipe = colorViaShape;
} else {
- if (sg2d.strokeState != sg2d.STROKE_THIN) {
+ if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) {
sg2d.drawpipe = colorViaShape;
} else {
sg2d.drawpipe = colorPrimitives;
@@ -508,9 +510,9 @@
sg2d.loops = getRenderLoops(sg2d);
// assert(sg2d.surfaceData == this);
}
- } else if (sg2d.compositeState == sg2d.COMP_CUSTOM) {
+ } else if (sg2d.compositeState == SunGraphics2D.COMP_CUSTOM) {
if (sg2d.antialiasHint == SunHints.INTVAL_ANTIALIAS_ON) {
- if (sg2d.clipState == sg2d.CLIP_SHAPE) {
+ if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
sg2d.drawpipe = AAClipCompViaShape;
sg2d.fillpipe = AAClipCompViaShape;
sg2d.shapepipe = AAClipCompShape;
@@ -525,7 +527,7 @@
sg2d.drawpipe = compViaShape;
sg2d.fillpipe = compViaShape;
sg2d.shapepipe = compShape;
- if (sg2d.clipState == sg2d.CLIP_SHAPE) {
+ if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
sg2d.textpipe = clipCompText;
} else {
sg2d.textpipe = compText;
@@ -535,7 +537,7 @@
sg2d.alphafill = getMaskFill(sg2d);
// assert(sg2d.surfaceData == this);
if (sg2d.alphafill != null) {
- if (sg2d.clipState == sg2d.CLIP_SHAPE) {
+ if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
sg2d.drawpipe = AAClipColorViaShape;
sg2d.fillpipe = AAClipColorViaShape;
sg2d.shapepipe = AAClipColorShape;
@@ -544,8 +546,8 @@
sg2d.drawpipe = AAColorViaShape;
sg2d.fillpipe = AAColorViaShape;
sg2d.shapepipe = AAColorShape;
- if (sg2d.paintState > sg2d.PAINT_OPAQUECOLOR ||
- sg2d.compositeState > sg2d.COMP_ISCOPY)
+ if (sg2d.paintState > SunGraphics2D.PAINT_OPAQUECOLOR ||
+ sg2d.compositeState > SunGraphics2D.COMP_ISCOPY)
{
sg2d.textpipe = colorText;
} else {
@@ -553,7 +555,7 @@
}
}
} else {
- if (sg2d.clipState == sg2d.CLIP_SHAPE) {
+ if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
sg2d.drawpipe = AAClipPaintViaShape;
sg2d.fillpipe = AAClipPaintViaShape;
sg2d.shapepipe = AAClipPaintShape;
@@ -565,9 +567,9 @@
sg2d.textpipe = paintText;
}
}
- } else if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR ||
- sg2d.compositeState > sg2d.COMP_ISCOPY ||
- sg2d.clipState == sg2d.CLIP_SHAPE)
+ } else if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR ||
+ sg2d.compositeState > SunGraphics2D.COMP_ISCOPY ||
+ sg2d.clipState == SunGraphics2D.CLIP_SHAPE)
{
sg2d.drawpipe = paintViaShape;
sg2d.fillpipe = paintViaShape;
@@ -575,24 +577,24 @@
sg2d.alphafill = getMaskFill(sg2d);
// assert(sg2d.surfaceData == this);
if (sg2d.alphafill != null) {
- if (sg2d.clipState == sg2d.CLIP_SHAPE) {
+ if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
sg2d.textpipe = clipColorText;
} else {
sg2d.textpipe = colorText;
}
} else {
- if (sg2d.clipState == sg2d.CLIP_SHAPE) {
+ if (sg2d.clipState == SunGraphics2D.CLIP_SHAPE) {
sg2d.textpipe = clipPaintText;
} else {
sg2d.textpipe = paintText;
}
}
} else {
- if (sg2d.transformState >= sg2d.TRANSFORM_TRANSLATESCALE) {
+ if (sg2d.transformState >= SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
sg2d.drawpipe = colorViaShape;
sg2d.fillpipe = colorViaShape;
} else {
- if (sg2d.strokeState != sg2d.STROKE_THIN) {
+ if (sg2d.strokeState != SunGraphics2D.STROKE_THIN) {
sg2d.drawpipe = colorViaShape;
} else {
sg2d.drawpipe = colorPrimitives;
@@ -718,7 +720,7 @@
*/
public RenderLoops getRenderLoops(SunGraphics2D sg2d) {
SurfaceType src = getPaintSurfaceType(sg2d);
- CompositeType comp = (sg2d.compositeState == sg2d.COMP_ISCOPY
+ CompositeType comp = (sg2d.compositeState == SunGraphics2D.COMP_ISCOPY
? CompositeType.SrcNoEa
: sg2d.imageComp);
SurfaceType dst = sg2d.getSurfaceData().getSurfaceType();
@@ -793,6 +795,7 @@
* @return the field type of this <code>Transparency</code>, which is
* either OPAQUE, BITMASK or TRANSLUCENT.
*/
+ @Override
public int getTransparency() {
return getColorModel().getTransparency();
}
Index: j2se/src/share/classes/sun/java2d/SurfaceDataProxy.java
===================================================================
--- j2se/src/share/classes/sun/java2d/SurfaceDataProxy.java (Revision 254)
+++ j2se/src/share/classes/sun/java2d/SurfaceDataProxy.java (Arbeitskopie)
@@ -37,7 +37,6 @@
import sun.java2d.loops.Blit;
import sun.java2d.loops.BlitBg;
import sun.awt.image.SurfaceManager;
-import sun.awt.image.SurfaceManager.FlushableCacheData;
import java.security.AccessController;
import sun.security.action.GetPropertyAction;
@@ -71,7 +70,7 @@
static {
cachingAllowed = true;
- String manimg = (String)AccessController.doPrivileged(
+ String manimg = AccessController.doPrivileged(
new GetPropertyAction("sun.java2d.managedimages"));
if (manimg != null && manimg.equals("false")) {
cachingAllowed = false;
@@ -79,7 +78,7 @@
}
defaultThreshold = 1;
- String num = (String)AccessController.doPrivileged(
+ String num = AccessController.doPrivileged(
new GetPropertyAction("sun.java2d.accthreshold"));
if (num != null) {
try {
@@ -144,6 +143,7 @@
this.countdown = threshold;
}
+ @Override
public synchronized boolean isCurrent() {
return (--countdown >= 0);
}
@@ -286,6 +286,7 @@
* Returns a boolean that indicates if the cached object is
* no longer needed and should be removed from the cache.
*/
+ @Override
public boolean flush(boolean deaccelerated) {
if (deaccelerated) {
invalidate();
@@ -339,6 +340,7 @@
* Invoked when the display mode has changed.
* This method will invalidate and drop the internal cachedSD object.
*/
+ @Override
public void displayChanged() {
flush();
}
@@ -346,6 +348,7 @@
/**
* Invoked when the palette has changed.
*/
+ @Override
public void paletteChanged() {
// We could potentially get away with just resetting cacheTracker
// here but there is a small window of vulnerability in the
Index: j2se/src/share/classes/sun/java2d/StateTrackableDelegate.java
===================================================================
--- j2se/src/share/classes/sun/java2d/StateTrackableDelegate.java (Revision 254)
+++ j2se/src/share/classes/sun/java2d/StateTrackableDelegate.java (Arbeitskopie)
@@ -96,6 +96,7 @@
* @inheritDoc
* @since 1.7
*/
+ @Override
public State getState() {
return theState;
}
@@ -104,6 +105,7 @@
* @inheritDoc
* @since 1.7
*/
+ @Override
public synchronized StateTracker getStateTracker() {
StateTracker st = theTracker;
if (st == null) {
Index: j2se/src/share/classes/sun/java2d/Spans.java
===================================================================
--- j2se/src/share/classes/sun/java2d/Spans.java (Revision 254)
+++ j2se/src/share/classes/sun/java2d/Spans.java (Arbeitskopie)
@@ -315,6 +315,7 @@
* position. The end position is ignored
* in this ranking.
*/
+ @Override
public int compareTo(Object o) {
Span otherSpan = (Span) o;
float otherStart = otherSpan.getStart();
@@ -331,6 +332,7 @@
return result;
}
+ @Override
public String toString() {
return "Span: " + mStart + " to " + mEnd;
}
@@ -361,6 +363,7 @@
}
+ @Override
public int compare(Object o1, Object o2) {
int result;
Span span1 = (Span) o1;
Index: j2se/src/share/classes/sun/java2d/Disposer.java
===================================================================
--- j2se/src/share/classes/sun/java2d/Disposer.java (Revision 254)
+++ j2se/src/share/classes/sun/java2d/Disposer.java (Arbeitskopie)
@@ -58,7 +58,7 @@
java.security.AccessController.doPrivileged(
new sun.security.action.LoadLibraryAction("awt"));
initIDs();
- String type = (String) java.security.AccessController.doPrivileged(
+ String type = java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("sun.java2d.reftype"));
if (type != null) {
if (type.equals("weak")) {
Index: j2se/src/share/classes/sun/java2d/StateTracker.java
===================================================================
--- j2se/src/share/classes/sun/java2d/StateTracker.java (Revision 254)
+++ j2se/src/share/classes/sun/java2d/StateTracker.java (Arbeitskopie)
@@ -70,6 +70,7 @@
* @since 1.7
*/
public StateTracker ALWAYS_CURRENT = new StateTracker() {
+ @Override
public boolean isCurrent() {
return true;
}
@@ -87,6 +88,7 @@
* @since 1.7
*/
public StateTracker NEVER_CURRENT = new StateTracker() {
+ @Override
public boolean isCurrent() {
return false;
}
Index: j2se/src/share/classes/sun/java2d/SunCompositeContext.java
===================================================================
--- j2se/src/share/classes/sun/java2d/SunCompositeContext.java (Revision 254)
+++ j2se/src/share/classes/sun/java2d/SunCompositeContext.java (Arbeitskopie)
@@ -76,6 +76,7 @@
/**
* Release resources allocated for context.
*/
+ @Override
public void dispose() {
}
@@ -88,6 +89,7 @@
* @param src2 The second source tile for the compositing operation.
* @param dst The tile where the result of the operation is stored.
*/
+ @Override
public void compose(Raster srcArg, Raster dstIn, WritableRaster dstOut) {
WritableRaster src;
int w;
Index: j2se/src/share/classes/sun/java2d/HeadlessGraphicsEnvironment.java
===================================================================
--- j2se/src/share/classes/sun/java2d/HeadlessGraphicsEnvironment.java (Revision 254)
+++ j2se/src/share/classes/sun/java2d/HeadlessGraphicsEnvironment.java (Arbeitskopie)
@@ -31,27 +31,8 @@
import java.awt.HeadlessException;
import java.awt.image.BufferedImage;
import java.awt.Font;
-import java.text.AttributedCharacterIterator;
-import java.awt.print.PrinterJob;
-import java.util.Map;
-import java.util.Hashtable;
import java.util.Locale;
-import java.util.Vector;
-import java.util.StringTokenizer;
-import java.util.ResourceBundle;
-import java.util.MissingResourceException;
-import java.io.IOException;
-import java.io.FilenameFilter;
-import java.io.File;
-import java.util.NoSuchElementException;
import sun.awt.FontConfiguration;
-import java.util.TreeMap;
-import java.util.Set;
-import java.awt.font.TextAttribute;
-import java.io.InputStream;
-import java.io.FileInputStream;
-import java.io.BufferedInputStream;
-import java.util.Properties;
import java.awt.Point;
import java.awt.Rectangle;
@@ -72,35 +53,44 @@
}
}
+ @Override
public GraphicsDevice[] getScreenDevices()
throws HeadlessException {
throw new HeadlessException();
}
+ @Override
public GraphicsDevice getDefaultScreenDevice()
throws HeadlessException {
throw new HeadlessException();
}
+ @Override
public Point getCenterPoint() throws HeadlessException {
throw new HeadlessException();
}
+ @Override
public Rectangle getMaximumWindowBounds() throws HeadlessException {
throw new HeadlessException();
}
+ @Override
public Graphics2D createGraphics(BufferedImage img) {
return ge.createGraphics(img); }
+ @Override
public Font[] getAllFonts() { return ge.getAllFonts(); }
+ @Override
public String[] getAvailableFontFamilyNames() {
return ge.getAvailableFontFamilyNames(); }
+ @Override
public String[] getAvailableFontFamilyNames(Locale l) {
return ge.getAvailableFontFamilyNames(l); }
+ @Override
public FontConfiguration getFontConfiguration() {
if (fontSupport != null) {
return fontSupport.getFontConfiguration();