]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
FOP-2265: Enable xlint cast; patch submitted by Simon Steiner
authorLuis Bernardo <lbernardo@apache.org>
Sat, 13 Jul 2013 22:26:09 +0000 (22:26 +0000)
committerLuis Bernardo <lbernardo@apache.org>
Sat, 13 Jul 2013 22:26:09 +0000 (22:26 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1502902 13f79535-47bb-0310-9956-ffa450edef68

31 files changed:
src/java/org/apache/fop/afp/AFPResourceManager.java
src/java/org/apache/fop/afp/modca/MapPageOverlay.java
src/java/org/apache/fop/area/BodyRegion.java
src/java/org/apache/fop/area/LineArea.java
src/java/org/apache/fop/events/EventExceptionManager.java
src/java/org/apache/fop/fo/ElementMappingRegistry.java
src/java/org/apache/fop/fo/expr/PropertyParser.java
src/java/org/apache/fop/fo/properties/CommonFont.java
src/java/org/apache/fop/fo/properties/FontFamilyProperty.java
src/java/org/apache/fop/fonts/FontUtil.java
src/java/org/apache/fop/fonts/truetype/TTFFile.java
src/java/org/apache/fop/hyphenation/CharVector.java
src/java/org/apache/fop/hyphenation/TernaryTree.java
src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java
src/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java
src/java/org/apache/fop/layoutmgr/LocalBreaker.java
src/java/org/apache/fop/layoutmgr/PageBreaker.java
src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
src/java/org/apache/fop/pdf/PDFFilterList.java
src/java/org/apache/fop/render/afp/AFPDocumentHandler.java
src/java/org/apache/fop/render/intermediate/IFRenderer.java
src/java/org/apache/fop/render/java2d/Java2DGraphics2DAdapter.java
src/java/org/apache/fop/render/ps/ImageEncoderPNG.java
src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java
src/java/org/apache/fop/render/ps/PSImageHandlerGraphics2D.java
src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfJforCmd.java
src/java/org/apache/fop/render/rtf/rtflib/rtfdoc/RtfList.java
src/java/org/apache/fop/svg/PDFTextUtil.java
src/java/org/apache/fop/util/text/AdvancedMessageFormat.java

index 99b28cafd2007b3dd340a92279da4f902cf230db..2eb0b55969dc673e63860e5dddb8dbd59c54277e 100644 (file)
@@ -279,20 +279,20 @@ public class AFPResourceManager {
      */
     public boolean includeCachedObject(AFPResourceInfo resourceInfo, AFPObjectAreaInfo areaInfo) {
 
-            String objectName;
+        String objectName;
 
-            AbstractCachedObject cachedObject = (AbstractCachedObject)includeObjectCache.get(resourceInfo);
+        AbstractCachedObject cachedObject = includeObjectCache.get(resourceInfo);
 
-            if (cachedObject != null) {
-                if (areaInfo != null) {
-                    cachedObject.dataObjectInfo.setObjectAreaInfo(areaInfo);
-                }
-                cachedObject.includeObject();
-
-                return true;
-            } else {
-                return false;
+        if (cachedObject != null) {
+            if (areaInfo != null) {
+                cachedObject.dataObjectInfo.setObjectAreaInfo(areaInfo);
             }
+            cachedObject.includeObject();
+
+            return true;
+        } else {
+            return false;
+        }
     }
 
 
@@ -382,8 +382,7 @@ public class AFPResourceManager {
         resourceInfo.setName(resourceName);
         resourceInfo.setUri(uri.toASCIIString());
 
-        AbstractCachedObject cachedObject = (AbstractCachedObject)
-                includeObjectCache.get(resourceInfo);
+        AbstractCachedObject cachedObject = includeObjectCache.get(resourceInfo);
         if (cachedObject == null) {
             if (log.isDebugEnabled()) {
                 log.debug("Adding included resource: " + resourceName);
@@ -425,7 +424,7 @@ public class AFPResourceManager {
         resourceInfo.setName(resourceName);
         resourceInfo.setUri(uri.toASCIIString());
 
-        AbstractCachedObject cachedObject = (AbstractCachedObject) includeObjectCache.get(resourceInfo);
+        AbstractCachedObject cachedObject = includeObjectCache.get(resourceInfo);
         if (cachedObject == null) {
             ResourceGroup resourceGroup = streamer.getResourceGroup(resourceLevel);
 
index 508a3299b2c985dec7055d2c938302e77575b27a..8b689de715388ee7f55ca00b472f7e6dde34af74 100644 (file)
@@ -99,8 +99,8 @@ public class MapPageOverlay extends AbstractAFPObject {
 
         // Structured field ID for a MPO
         data[3] = (byte) 0xD3;
-        data[4] = (byte) Type.MAP;
-        data[5] = (byte) Category.PAGE_OVERLAY;
+        data[4] = Type.MAP;
+        data[5] = Category.PAGE_OVERLAY;
 
         data[6] = 0x00; // Reserved
         data[7] = 0x00; // Reserved
index b71f689a1289bc80526517932513974a7d7ea893..89bb206f2d73028a29af41ce873095dfd2be18c0 100644 (file)
@@ -135,7 +135,7 @@ public class BodyRegion extends RegionReference {
         List<Span> spans = getMainReference().getSpans();
         int previousSpanCount = spans.size() - 1;
         for (int i = 0; i < previousSpanCount; i++) {
-            usedBPD += ((Span)spans.get(i)).getHeight();
+            usedBPD += spans.get(i).getHeight();
         }
         return getBPD() - usedBPD;
     }
index 169c3728f6b2e550cfe19850f7e8816061031247..b7a580cb08ac7e3617743adc5e136bb34b730afd 100644 (file)
@@ -258,7 +258,7 @@ public class LineArea extends Area {
             boolean bUnresolvedAreasPresent = false;
             // recursively apply variation factor to descendant areas
             for (int i = 0, len = inlineAreas.size(); i < len; i++) {
-                bUnresolvedAreasPresent |= ((InlineArea) inlineAreas.get(i))
+                bUnresolvedAreasPresent |= inlineAreas.get(i)
                         .applyVariationFactor(adjustingInfo.variationFactor,
                                 adjustingInfo.availableStretch,
                                 adjustingInfo.availableShrink);
index 3494dc560dbc86f89101d93c4fe306405c414772..e9208fbc63d1c1c27a0c374a1ec569ba330dc792 100644 (file)
@@ -53,7 +53,7 @@ public final class EventExceptionManager {
      */
     public static void throwException(Event event, String exceptionClass) throws Throwable {
         if (exceptionClass != null) {
-            ExceptionFactory factory = (ExceptionFactory)EXCEPTION_FACTORIES.get(exceptionClass);
+            ExceptionFactory factory = EXCEPTION_FACTORIES.get(exceptionClass);
             if (factory != null) {
                 throw factory.createException(event);
             } else {
index b6baeca2b96f8449b4b74f3ff041dfdc3779aeed..08e960b1d2edd2badbcdca93d977a39c6e080256 100644 (file)
@@ -160,7 +160,7 @@ public class ElementMappingRegistry {
      * @return the handling DOMImplementation, or null if not applicable
      */
     public DOMImplementation getDOMImplementationForNamespace(String namespaceURI) {
-        ElementMapping mapping = (ElementMapping)this.namespaces.get(namespaceURI);
+        ElementMapping mapping = this.namespaces.get(namespaceURI);
         if (mapping == null) {
             return null;
         } else {
@@ -175,7 +175,7 @@ public class ElementMappingRegistry {
      *         available.
      */
     public ElementMapping getElementMapping(String namespaceURI) {
-        return (ElementMapping)this.namespaces.get(namespaceURI);
+        return this.namespaces.get(namespaceURI);
     }
 
     /**
index 574fc0e127c32a3e5cbdb6ab86a5473210e90d49..cac115d6edcff05ca2317b54ed914e0afdf5c6a8 100644 (file)
@@ -393,7 +393,7 @@ public final class PropertyParser extends PropertyTokenizer {
                 }
             }
         }
-        return (Property[]) args.toArray(new Property [ args.size() ]);
+        return args.toArray(new Property [ args.size() ]);
     }
 
     /**
index 63f037724ff4856bf6162fc9973b74331b0305a2..a22fc4d040294a49eb2de90cf6d9b97b23d0312c 100644 (file)
@@ -144,7 +144,7 @@ public final class CommonFont {
 
     /** @return the first font-family name in the list */
     public String getFirstFontFamily() {
-        return ((Property) fontFamily.list.get(0)).getString();
+        return fontFamily.list.get(0).getString();
     }
 
     /** @return the "font-selection-strategy" property */
index b59c22de64a8ce16cc0487f9c7ecfef9e2cc99b4..2c22fc17e28f1bd7f0a868684a860ab6977fccef 100644 (file)
@@ -140,7 +140,7 @@ public final class FontFamilyProperty extends ListProperty {
     /** {@inheritDoc} */
     public String getString() {
         if (list.size() > 0) {
-            Property first = (Property)list.get(0);
+            Property first = list.get(0);
             return first.getString();
         } else {
             return super.getString();
index b97e3a4072675298086f8221d535b16e3d4f512f..1966d9fca7d208853593dfc7efd8491305b18afe 100644 (file)
@@ -40,7 +40,7 @@ public final class FontUtil {
         int weight = 400;
         try {
             weight = Integer.parseInt(text);
-            weight = ((int)weight / 100) * 100;
+            weight = (weight / 100) * 100;
             weight = Math.max(weight, 100);
             weight = Math.min(weight, 900);
         } catch (NumberFormatException nfe) {
index 3c234e0a376613792bf995682249e23d27c7ac3b..2e78ef7f05bf350ac2b31be558589c764fadc067 100644 (file)
@@ -990,7 +990,7 @@ public class TTFFile {
         int[] bboxInTTFUnits = mtxTab[glyphIndex].getBoundingBox();
         int[] bbox = new int[4];
         for (int i = 0; i < 4; i++) {
-            bbox[i] = (int) convertTTFUnit2PDFUnit(bboxInTTFUnits[i]);
+            bbox[i] = convertTTFUnit2PDFUnit(bboxInTTFUnits[i]);
         }
         return bbox;
     }
index de95a769971dadf6825cda26d4bac81467b3960b..de1dea533c325e89b239978857d0fe904a41d2d6 100644 (file)
@@ -103,7 +103,7 @@ public class CharVector implements Cloneable, Serializable {
     /** {@inheritDoc} */
     public Object clone() throws CloneNotSupportedException {
         CharVector cv = (CharVector) super.clone();
-        cv.array = (char[])array.clone();
+        cv.array = array.clone();
         return cv;
     }
 
index 92f7a84495d4ab2013dd04cf5f32532984332531..e9798fa9cf87894c862f150033b5d5950e9b599e 100644 (file)
@@ -284,7 +284,7 @@ public class TernaryTree implements Cloneable, Serializable {
             }
         }
         if (a[start + i] != 0) {
-            return (int)-a[start + i];
+            return -a[start + i];
         }
         return 0;
 
@@ -408,10 +408,10 @@ public class TernaryTree implements Cloneable, Serializable {
     /** {@inheritDoc} */
     public Object clone() throws CloneNotSupportedException {
         TernaryTree t = (TernaryTree) super.clone();
-        t.lo = (char[])this.lo.clone();
-        t.hi = (char[])this.hi.clone();
-        t.eq = (char[])this.eq.clone();
-        t.sc = (char[])this.sc.clone();
+        t.lo = this.lo.clone();
+        t.hi = this.hi.clone();
+        t.eq = this.eq.clone();
+        t.sc = this.sc.clone();
         t.kv = (CharVector)this.kv.clone();
 
         return t;
index 9ba4a0b149bf7da189dda04f3db014c90208c1d9..51e80e8d4b19193ba01db00eccd6ea8f5dbb4e9d 100644 (file)
@@ -861,7 +861,7 @@ public abstract class AbstractBreaker {
         }
         int averageLineLength = 0;
         if (accumulatedLineLength > 0 && boxCount > 0) {
-            averageLineLength = (int) (accumulatedLineLength / boxCount);
+            averageLineLength = accumulatedLineLength / boxCount;
             log.debug("Average line length = " + averageLineLength);
             if (averageLineLength < greatestMinimumLength) {
                 averageLineLength = greatestMinimumLength;
index edfb389ed02f4a18fa32d3b83c4474254fce5d1f..53de9e1ed234fce59a96e1b315f2e3588c0690a0 100644 (file)
@@ -244,7 +244,7 @@ public abstract class AbstractPageSequenceLayoutManager extends AbstractLayoutMa
                 PageViewport pv = areaTreeModel.getPage(seq, page);
                 int originalPosition = rm.getPosition();
                 rm.changePositionTo(Constants.EN_LEWP);
-                mark = (Marker) pv.resolveMarker(rm);
+                mark = pv.resolveMarker(rm);
                 // this is probably not necessary since the RM will not be used again, but to be safe...
                 rm.changePositionTo(originalPosition);
                 if (mark != null) {
index 0be0c9437acb5a84019bc4940a0ae15fde3a973f..68d64199a396b946252bcb1f0f73b84b3469e824 100644 (file)
@@ -71,7 +71,7 @@ public class BlockKnuthSequence extends KnuthSequence {
         if (keepTogether) {
             breakElement.setPenaltyValue(KnuthElement.INFINITE);
             add(breakElement);
-        } else if (!((ListElement) getLast()).isGlue()) {
+        } else if (!getLast().isGlue()) {
             breakElement.setPenaltyValue(0);
             add(breakElement);
         }
index bb08446cc83dca506d6ac7f67488cc45ea79eeae..bcb86e501ef121dc7637f2e315561dc4c03ea350 100644 (file)
@@ -115,7 +115,7 @@ public abstract class LocalBreaker extends AbstractBreaker {
     protected void doPhase3(PageBreakingAlgorithm alg, int partCount, BlockSequence originalList,
             BlockSequence effectiveList) {
         if (partCount > 1) {
-            PageBreakPosition pos = (PageBreakPosition) alg.getPageBreaks().getFirst();
+            PageBreakPosition pos = alg.getPageBreaks().getFirst();
             int firstPartLength = ElementListUtils.calcContentLength(effectiveList,
                     effectiveList.ignoreAtStart, pos.getLeafPos());
             overflow += alg.totalWidth - firstPartLength;
index 6a10fa22ff931ff216321921ab8904c77c38da5b..d9ca096c3244789bafcd89aaad9f13b23065ec9b 100644 (file)
@@ -328,8 +328,7 @@ public class PageBreaker extends AbstractBreaker {
             //restarting point
             addAreas(alg, restartPoint, originalList, effectiveList);
             //Get page break from which we restart
-            PageBreakPosition pbp = (PageBreakPosition)
-                    alg.getPageBreaks().get(restartPoint - 1);
+            PageBreakPosition pbp = alg.getPageBreaks().get(restartPoint - 1);
             newStartPos = alg.par.getFirstBoxIndex(pbp.getLeafPos() + 1);
             //Handle page break right here to avoid any side-effects
             if (newStartPos > 0) {
index 878a1285a233044b842c4f5e0fce6a04683066bb..c8f2cea858cec5e912711bdd83ded7b139c4a2e7 100644 (file)
@@ -289,7 +289,7 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager
         }
         int n = childrenLMs.size();
         for (int j = 0; j < n; j++) {
-            LayoutManager lm = (LayoutManager) childrenLMs.get(j);
+            LayoutManager lm = childrenLMs.get(j);
             if (lm == null) {
                 return;
             } else if (lm instanceof RetrieveTableMarkerLayoutManager) {
index d423b339d659705735fc0be7be3f6a50b0b63f29..4f17c2d0caa0e052ac3e68014df45262d368077e 100644 (file)
@@ -350,7 +350,7 @@ public class TableContentLayoutManager implements PercentBaseContext {
         Position lastPos = null;
         Position lastCheckPos = null;
         while (parentIter.hasNext()) {
-            Position pos = (Position)parentIter.next();
+            Position pos = parentIter.next();
             if (pos instanceof SpaceHandlingBreakPosition) {
                 //This position has only been needed before addAreas was called, now we need the
                 //original one created by the layout manager.
index 3f26f454cbb6a074398ee44656ee967359228762..bfb940c514c6b01a503ccfeef06bd0d075d7eb90 100644 (file)
@@ -250,7 +250,7 @@ public class PDFFilterList {
         // run the filters
         int nonNullParams = 0;
         for (int count = 0; count < filters.size(); count++) {
-            PDFFilter filter = (PDFFilter)filters.get(count);
+            PDFFilter filter = filters.get(count);
             // place the names in our local vector in reverse order
             if (filter.getName().length() > 0) {
                 names.add(0, filter.getName());
@@ -365,7 +365,7 @@ public class PDFFilterList {
         OutputStream out = stream;
         if (!isDisableAllFilters()) {
             for (int count = filters.size() - 1; count >= 0; count--) {
-                PDFFilter filter = (PDFFilter)filters.get(count);
+                PDFFilter filter = filters.get(count);
                 out = filter.applyFilter(out);
             }
         }
index cd8304b4b008e3aee65c4628d8c9a3f263c01baa..8962da3047e446fa92940aadbe7ad73d90ac3c15 100644 (file)
@@ -446,7 +446,7 @@ public class AFPDocumentHandler extends AbstractBinaryWritingIFDocumentHandler
      * @return document id of the corner image
      */
     public String getCachedRoundedCorner(String cornerKey) {
-        return (String)roundedCornerNameCache.get(cornerKey);
+        return roundedCornerNameCache.get(cornerKey);
     }
 
 
index f0d25a84dd3802aca019d609e98e2c3ec1df3cdb..9e6aae700e622c70f1df059d037abcc06dd5bf9d 100644 (file)
@@ -992,7 +992,7 @@ public class IFRenderer extends AbstractPathOrientedRenderer {
     }
 
     private Typeface getTypeface(String fontName) {
-        Typeface tf = (Typeface) fontInfo.getFonts().get(fontName);
+        Typeface tf = fontInfo.getFonts().get(fontName);
         if (tf instanceof LazyFont) {
             tf = ((LazyFont)tf).getRealFont();
         }
index 8fe93d051aaeb070eadbec7b437e9109782158fb..f136a046fec7c795e288b6f2940659465fcdbf57 100644 (file)
@@ -51,8 +51,8 @@ public class Java2DGraphics2DAdapter extends AbstractGraphics2DAdapter {
         float imw = (float)dim.getWidth() / 1000f;
         float imh = (float)dim.getHeight() / 1000f;
 
-        float sx = fwidth / (float)imw;
-        float sy = fheight / (float)imh;
+        float sx = fwidth / imw;
+        float sy = fheight / imh;
 
         Java2DRenderer renderer = (Java2DRenderer)context.getRenderer();
         Java2DGraphicsState state = renderer.state;
index bcda90bdaca301d3385ffef2392c6a1ea333db25..5746a3fbe0c27f11ea4b8332750e6875fa94f79c 100644 (file)
@@ -51,7 +51,7 @@ public class ImageEncoderPNG implements ImageEncoder {
      */
     public ImageEncoderPNG(ImageRawPNG image) {
         this.image = image;
-        ColorModel cm = ((ImageRawPNG) this.image).getColorModel();
+        ColorModel cm = this.image.getColorModel();
         if (cm instanceof IndexColorModel) {
             numberOfInterleavedComponents = 1;
         } else {
index d55e0960a2e92dce858ace57f19488e17a7df948..7bbe9bd8b7dd785abbfc7b4b974ed20809861558 100644 (file)
@@ -76,8 +76,8 @@ public class PSGraphics2DAdapter extends AbstractGraphics2DAdapter {
                    && ImageHandlerUtil.isConversionModeBitmap(foreign));
         }
 
-        float sx = paintAsBitmap ? 1.0f : (fwidth / (float)imw);
-        float sy = paintAsBitmap ? 1.0f : (fheight / (float)imh);
+        float sx = paintAsBitmap ? 1.0f : (fwidth / imw);
+        float sy = paintAsBitmap ? 1.0f : (fheight / imh);
 
         gen.commentln("%FOPBeginGraphics2D");
         gen.saveGraphicsState();
@@ -102,7 +102,7 @@ public class PSGraphics2DAdapter extends AbstractGraphics2DAdapter {
         gen.getCurrentState().concatMatrix(transform);
         if (paintAsBitmap) {
             //Fallback solution: Paint to a BufferedImage
-            int resolution = (int)Math.round(context.getUserAgent().getTargetResolution());
+            int resolution = Math.round(context.getUserAgent().getTargetResolution());
             RendererContextWrapper ctx = RendererContext.wrapRendererContext(context);
             BufferedImage bi = paintToBufferedImage(painter, ctx, resolution, false, false);
 
index 3293840e5bb315ace44bd9c5ea8def17079197e9..ed0b4e24ae1ce2073a9c0d0683c2ee8e05fbf0ba 100644 (file)
@@ -65,8 +65,8 @@ public class PSImageHandlerGraphics2D implements PSImageHandler {
         float imw = (float)dim.getWidth() / 1000f;
         float imh = (float)dim.getHeight() / 1000f;
 
-        float sx = fwidth / (float)imw;
-        float sy = fheight / (float)imh;
+        float sx = fwidth / imw;
+        float sy = fheight / imh;
 
         gen.commentln("%FOPBeginGraphics2D");
         gen.saveGraphicsState();
index c52ccb959d9a691cfd0ab13071ce17c854683d9a..dd007f774dc19e208ad46bcb309681fb25d59d53 100644 (file)
@@ -43,7 +43,7 @@ public class RtfJforCmd extends RtfContainer {
 
 
     RtfJforCmd(RtfContainer parent, Writer w, RtfAttributes attrs) throws IOException {
-        super((RtfContainer)parent, w);
+        super(parent, w);
         attrib = attrs;
     }
 
index 19e3e7188e84e7f366454ca02ace272e5f1fd22c..b7d01db00daf421b2a0a8743b930af8e6acb0465 100644 (file)
@@ -48,7 +48,7 @@ public class RtfList extends RtfContainer {
 
     /** Create an RTF list as a child of given container with given attributes */
     RtfList(RtfContainer parent, Writer w, RtfAttributes attr) throws IOException {
-        super((RtfContainer)parent, w, attr);
+        super(parent, w, attr);
 
         //random number generator for ids
         listId = new Integer(listIdGenerator.nextInt());
index 32aed4a391ac2614e975c4d12b89e493bd12692e..8325dce1fb9bf16be14336f2cca6695523b61f58 100644 (file)
@@ -104,7 +104,7 @@ public abstract class PDFTextUtil extends org.apache.fop.pdf.PDFTextUtil {
      * @return true if it's a multi-byte font
      */
     protected boolean isMultiByteFont(String name) {
-        Typeface f = (Typeface)fontInfo.getFonts().get(name);
+        Typeface f = fontInfo.getFonts().get(name);
         return f.isMultiByte();
     }
 
index 41b70046c5d1e1d73f5f6d755bfa5579665b336c..b34d87b27d8f555c93d88a6d0304362456194e07 100644 (file)
@@ -170,7 +170,7 @@ public class AdvancedMessageFormat {
             }
         } else {
             String format = parts[1];
-            PartFactory factory = (PartFactory)PART_FACTORIES.get(format);
+            PartFactory factory = PART_FACTORIES.get(format);
             if (factory == null) {
                 throw new IllegalArgumentException(
                         "No PartFactory available under the name: " + format);
@@ -184,7 +184,7 @@ public class AdvancedMessageFormat {
     }
 
     private static Function getFunction(String functionName) {
-        return (Function)FUNCTIONS.get(functionName);
+        return FUNCTIONS.get(functionName);
     }
 
     /**