TextAreaPainter.java

Index Score
org.gjt.sp.jedit.textarea
jEdit

View: Reasons, Metrics, Source Code

These are the metrics that contribute to the Enerjy Score for this file, ranked by impact. So the metrics listed at the top influence the score to a greater extent that the metrics listed at the bottom.

MetricDescription
DECL_COMMENTSComments in declarations
LINE_COMMENTNumber of line comments
JAVA0034JAVA0034 Missing braces in if statement
JAVA0110JAVA0110 Incorrect javadoc: no @return tag
COMMENTSComment lines
DOC_COMMENTNumber of javadoc comment lines
LINESNumber of lines in the source file
EXITSProcedure exits
PARAMSNumber of formal parameter declarations
ELOCEffective lines of code
SIZESize of the file in bytes
UNIQUE_OPERANDSNumber of unique operands
LOCLines of code
INTERFACE_COMPLEXITYInterface complexity
CYCLOMATICCyclomatic complexity
FUNCTIONSNumber of function declarations
PROGRAM_VOCABHalstead program vocabulary
OPERATORSNumber of operators
PROGRAM_LENGTHHalstead program length
LOGICAL_LINESNumber of statements
OPERANDSNumber of operands
RETURNSNumber of return points from functions
COMPARISONSNumber of comparison operators
BLOCKSNumber of blocks
JAVA0008JAVA0008 Empty catch block
JAVA0145JAVA0145 Tab character used in source file
JAVA0179JAVA0179 Local variable hides visible field
JAVA0108JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0138JAVA0138 N parameters defined for method (maximum: M)
WHITESPACENumber of whitespace lines
UNIQUE_OPERATORSNumber of unique operators
JAVA0117JAVA0117 Missing javadoc: method 'method'
JAVA0177JAVA0177 Variable declaration missing initializer
PROGRAM_VOLUMEHalstead program volume
JAVA0259JAVA0259 Return of collection/array field
JAVA0136JAVA0136 N methods defined in class (maximum: M)
JAVA0035JAVA0035 Missing braces in for statement
JAVA0126JAVA0126 Method declares unchecked exception in throws
JAVA0285JAVA0285 Dereference of potentially null variable
JAVA0100JAVA0100 Class contains N non-final fields (maximum: M)
JAVA0254JAVA0254 Use enhanced for loop construct instead of Iterator
EXEC_COMMENTSComments in executable code
LOOPSNumber of loops
JAVA0256JAVA0256 Assignment of external collection/array to field
/* * TextAreaPainter.java - Paints the text area * :tabSize=8:indentSize=8:noTabs=false: * :folding=explicit:collapseFolds=1: * * Copyright (C) 1999, 2005 Slava Pestov * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package org.gjt.sp.jedit.textarea; //{{{ Imports import javax.swing.text.*; import javax.swing.JComponent; import java.awt.event.MouseEvent; import java.awt.font.*; import java.awt.geom.AffineTransform; import java.awt.*; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.util.*; import org.gjt.sp.jedit.buffer.IndentFoldHandler; import org.gjt.sp.jedit.buffer.JEditBuffer; import org.gjt.sp.jedit.syntax.Chunk; import org.gjt.sp.jedit.syntax.SyntaxStyle; import org.gjt.sp.jedit.syntax.Token; import org.gjt.sp.jedit.Debug; import org.gjt.sp.util.Log; //}}} /** * The text area painter is the component responsible for displaying the * text of the current buffer. The only methods in this class that should * be called by plugins are those for adding and removing * text area extensions. * * @see #addExtension(TextAreaExtension) * @see #addExtension(int,TextAreaExtension) * @see #removeExtension(TextAreaExtension) * @see TextAreaExtension * @see TextArea * * @author Slava Pestov * @version $Id: TextAreaPainter.java 13048 2008-07-12 14:58:16Z k_satoda $ */ public class TextAreaPainter extends JComponent implements TabExpander { //{{{ Layers /** * The lowest possible layer. * @see #addExtension(int,TextAreaExtension) * @since jEdit 4.0pre4 */ public static final int LOWEST_LAYER = Integer.MIN_VALUE; /** * Below selection layer. The JDiff plugin will use this. * @see #addExtension(int,TextAreaExtension) * @since jEdit 4.0pre4 */ public static final int BACKGROUND_LAYER = -60; /** * The line highlight and collapsed fold highlight layer. * @see #addExtension(int,TextAreaExtension) * @since jEdit 4.0pre7 */ public static final int LINE_BACKGROUND_LAYER = -50; /** * Below selection layer. * @see #addExtension(int,TextAreaExtension) * @since jEdit 4.0pre4 */ public static final int BELOW_SELECTION_LAYER = -40; /** * Selection layer. Most extensions will be above this layer, but some * (eg, JDiff) will want to be below the selection. * @see #addExtension(int,TextAreaExtension) * @since jEdit 4.0pre4 */ public static final int SELECTION_LAYER = -30; /** * Wrap guide layer. Most extensions will be above this layer. * @since jEdit 4.0pre4 */ public static final int WRAP_GUIDE_LAYER = -20; /** * Below most extensions layer. * @see #addExtension(int,TextAreaExtension) * @since jEdit 4.0pre4 */ public static final int BELOW_MOST_EXTENSIONS_LAYER = -10; /** * Default extension layer. This is above the wrap guide but below the * structure highlight. * @since jEdit 4.0pre4 */ public static final int DEFAULT_LAYER = 0; /** * Block caret layer. Most extensions will be below this layer. * @since jEdit 4.2pre1 */ public static final int BLOCK_CARET_LAYER = 50; /** * Bracket highlight layer. Most extensions will be below this layer. * @since jEdit 4.0pre4 */ public static final int BRACKET_HIGHLIGHT_LAYER = 100; /** * Text layer. Most extensions will be below this layer. * @since jEdit 4.2pre1 */ public static final int TEXT_LAYER = 200; /** * Caret layer. Most extensions will be below this layer. * @since jEdit 4.2pre1 */ public static final int CARET_LAYER = 300; /** * Highest possible layer. * @since jEdit 4.0pre4 */ public static final int HIGHEST_LAYER = Integer.MAX_VALUE; //}}} //{{{ setBounds() method /** * It is a bad idea to override this, but we need to get the component * event before the first repaint. */ @Override public void setBounds(int x, int y, int width, int height) { if(x == getX() && y == getY() && width == getWidth() && height == getHeight()) { return; } super.setBounds(x,y,width,height); textArea.recalculateVisibleLines(); if(!textArea.getBuffer().isLoading()) textArea.recalculateLastPhysicalLine(); textArea.propertiesChanged(); textArea.updateMaxHorizontalScrollWidth(); textArea.scrollBarsInitialized = true; textArea.repaintMgr.updateGraphics(); } //}}} //{{{ getFocusTraversalKeysEnabled() method /** * Makes the tab key work in Java 1.4. * @since jEdit 3.2pre4 */ @Override public boolean getFocusTraversalKeysEnabled() { return false; } //}}} //{{{ Getters and setters //{{{ getStyles() method /** * Returns the syntax styles used to paint colorized text. Entry <i>n</i> * will be used to paint tokens with id = <i>n</i>. * @return an array of SyntaxStyles * @see org.gjt.sp.jedit.syntax.Token */ public final SyntaxStyle[] getStyles() { return styles; } //}}} //{{{ setStyles() method /** * Sets the syntax styles used to paint colorized text. Entry <i>n</i> * will be used to paint tokens with id = <i>n</i>. * @param styles The syntax styles * @see org.gjt.sp.jedit.syntax.Token */ public final void setStyles(SyntaxStyle[] styles) { // assumed this is called after a font render context is set up. // changing font render context settings without a setStyles() // call will not reset cached monospaced font info. fonts.clear(); this.styles = styles; styles[Token.NULL] = new SyntaxStyle(getForeground(),null,getFont()); repaint(); } //}}} //{{{ getCaretColor() method /** * Returns the caret color. */ public final Color getCaretColor() { return caretColor; } //}}} //{{{ setCaretColor() method /** * Sets the caret color. * @param caretColor The caret color */ public final void setCaretColor(Color caretColor) { this.caretColor = caretColor; if(textArea.getBuffer() != null) textArea.invalidateLine(textArea.getCaretLine()); } //}}} //{{{ getSelectionColor() method /** * Returns the selection color. */ public final Color getSelectionColor() { return selectionColor; } //}}} //{{{ setSelectionColor() method /** * Sets the selection color. * @param selectionColor The selection color */ public final void setSelectionColor(Color selectionColor) { this.selectionColor = selectionColor; textArea.repaint(); } //}}} //{{{ getMultipleSelectionColor() method /** * Returns the multiple selection color. * @since jEdit 4.2pre1 */ public final Color getMultipleSelectionColor() { return multipleSelectionColor; } //}}} //{{{ setMultipleSelectionColor() method /** * Sets the multiple selection color. * @param multipleSelectionColor The multiple selection color * @since jEdit 4.2pre1 */ public final void setMultipleSelectionColor(Color multipleSelectionColor) { this.multipleSelectionColor = multipleSelectionColor; textArea.repaint(); } //}}} //{{{ getLineHighlightColor() method /** * Returns the line highlight color. */ public final Color getLineHighlightColor() { return lineHighlightColor; } //}}} //{{{ setLineHighlightColor() method /** * Sets the line highlight color. * @param lineHighlightColor The line highlight color */ public final void setLineHighlightColor(Color lineHighlightColor) { this.lineHighlightColor = lineHighlightColor; if(textArea.getBuffer() != null) textArea.invalidateLine(textArea.getCaretLine()); } //}}} //{{{ isLineHighlightEnabled() method /** * Returns true if line highlight is enabled, false otherwise. */ public final boolean isLineHighlightEnabled() { return lineHighlight; } //}}} //{{{ setLineHighlightEnabled() method /** * Enables or disables current line highlighting. * @param lineHighlight True if current line highlight should be enabled, * false otherwise */ public final void setLineHighlightEnabled(boolean lineHighlight) { this.lineHighlight = lineHighlight; textArea.repaint(); } //}}} //{{{ getStructureHighlightColor() method /** * Returns the structure highlight color. * @since jEdit 4.2pre3 */ public final Color getStructureHighlightColor() { return structureHighlightColor; } //}}} //{{{ setStructureHighlightColor() method /** * Sets the structure highlight color. * @param structureHighlightColor The bracket highlight color * @since jEdit 4.2pre3 */ public final void setStructureHighlightColor( Color structureHighlightColor) { this.structureHighlightColor = structureHighlightColor; textArea.invalidateStructureMatch(); } //}}} //{{{ isStructureHighlightEnabled() method /** * Returns true if structure highlighting is enabled, false otherwise. * @since jEdit 4.2pre3 */ public final boolean isStructureHighlightEnabled() { return structureHighlight; } //}}} //{{{ setStructureHighlightEnabled() method /** * Enables or disables structure highlighting. * @param structureHighlight True if structure highlighting should be * enabled, false otherwise * @since jEdit 4.2pre3 */ public final void setStructureHighlightEnabled(boolean structureHighlight) { this.structureHighlight = structureHighlight; textArea.invalidateStructureMatch(); } //}}} //{{{ isBlockCaretEnabled() method /** * Returns true if the caret should be drawn as a block, false otherwise. */ public final boolean isBlockCaretEnabled() { return blockCaret; } //}}} //{{{ setBlockCaretEnabled() method /** * Sets if the caret should be drawn as a block, false otherwise. * @param blockCaret True if the caret should be drawn as a block, * false otherwise. */ public final void setBlockCaretEnabled(boolean blockCaret) { this.blockCaret = blockCaret; extensionMgr.removeExtension(caretExtension); if(blockCaret) addExtension(BLOCK_CARET_LAYER,caretExtension); else addExtension(CARET_LAYER,caretExtension); if(textArea.getBuffer() != null) textArea.invalidateLine(textArea.getCaretLine()); } //}}} //{{{ isThickCaretEnabled() method /** * Returns true if the caret should be drawn with a thick line, false otherwise. * @since jEdit 4.3pre15 */ public final boolean isThickCaretEnabled() { return thickCaret; } //}}} //{{{ setThickCaretEnabled() method /** * Sets if the caret should be drawn with a thick line. * @param thickCaret * True if the caret should be drawn as a block, false otherwise. * @since jEdit 4.3pre15 */ public final void setThickCaretEnabled(boolean thickCaret) { this.thickCaret = thickCaret; if(textArea.getBuffer() != null) textArea.invalidateLine(textArea.getCaretLine()); } //}}} //{{{ getEOLMarkerColor() method /** * Returns the EOL marker color. */ public final Color getEOLMarkerColor() { return eolMarkerColor; } //}}} //{{{ setEOLMarkerColor() method /** * Sets the EOL marker color. * @param eolMarkerColor The EOL marker color */ public final void setEOLMarkerColor(Color eolMarkerColor) { this.eolMarkerColor = eolMarkerColor; repaint(); } //}}} //{{{ getEOLMarkersPainted() method /** * Returns true if EOL markers are drawn, false otherwise. */ public final boolean getEOLMarkersPainted() { return eolMarkers; } //}}} //{{{ setEOLMarkersPainted() method /** * Sets if EOL markers are to be drawn. * @param eolMarkers True if EOL markers should be drawn, false otherwise */ public final void setEOLMarkersPainted(boolean eolMarkers) { this.eolMarkers = eolMarkers; repaint(); } //}}} //{{{ getWrapGuideColor() method /** * Returns the wrap guide color. */ public final Color getWrapGuideColor() { return wrapGuideColor; } //}}} //{{{ setWrapGuideColor() method /** * Sets the wrap guide color. * @param wrapGuideColor The wrap guide color */ public final void setWrapGuideColor(Color wrapGuideColor) { this.wrapGuideColor = wrapGuideColor; repaint(); } //}}} //{{{ isWrapGuidePainted() method /** * Returns true if the wrap guide is drawn, false otherwise. * @since jEdit 4.0pre4 */ public final boolean isWrapGuidePainted() { return wrapGuide; } //}}} //{{{ setWrapGuidePainted() method /** * Sets if the wrap guide is to be drawn. * @param wrapGuide True if the wrap guide should be drawn, false otherwise */ public final void setWrapGuidePainted(boolean wrapGuide) { this.wrapGuide = wrapGuide; repaint(); } //}}} //{{{ getFoldLineStyle() method /** * Returns the fold line style. The first element is the style for * lines with a fold level greater than 3. The remaining elements * are for fold levels 1 to 3. */ public final SyntaxStyle[] getFoldLineStyle() { return foldLineStyle; } //}}} //{{{ setFoldLineStyle() method /** * Sets the fold line style. The first element is the style for * lines with a fold level greater than 3. The remaining elements * are for fold levels 1 to 3. * @param foldLineStyle The fold line style */ public final void setFoldLineStyle(SyntaxStyle[] foldLineStyle) { this.foldLineStyle = foldLineStyle; repaint(); } //}}} //{{{ setAntiAliasEnabled() method /** * @deprecated use setAntiAlias(AntiAlias newMode) */ @Deprecated public void setAntiAliasEnabled(boolean isEnabled) { setAntiAlias(new AntiAlias(isEnabled)); } /** * As of jEdit 4.3pre4, a new JDK 1.6 subpixel antialias mode is supported. * * @since jEdit 4.2pre4 */ public void setAntiAlias(AntiAlias newValue) { this.antiAlias = newValue; updateRenderingHints(); } //}}} /** * @return the AntiAlias value that is currently used for TextAreas. * @since jedit 4.3pre4 */ public AntiAlias getAntiAlias() { return antiAlias; } //{{{ isAntiAliasEnabled() method /** * Returns if anti-aliasing is enabled. * @since jEdit 3.2pre6 * @deprecated - use @ref getAntiAlias() */ @Deprecated public boolean isAntiAliasEnabled() { return antiAlias.val() > 0; } //}}} //{{{ setFractionalFontMetricsEnabled() method /** * Sets if fractional font metrics should be enabled. Has no effect when * running on Java 1.1. * @since jEdit 3.2pre6 */ public void setFractionalFontMetricsEnabled(boolean fracFontMetrics) { this.fracFontMetrics = fracFontMetrics; updateRenderingHints(); } //}}} //{{{ isFractionalFontMetricsEnabled() method /** * Returns if fractional font metrics are enabled. * @since jEdit 3.2pre6 */ public boolean isFractionalFontMetricsEnabled() { return fracFontMetrics; } //}}} //{{{ getFontRenderContext() method /** * Returns the font render context. * @since jEdit 4.0pre4 */ public FontRenderContext getFontRenderContext() { return fontRenderContext; } //}}} //}}} //{{{ addExtension() method /** * Adds a text area extension, which can perform custom painting and * tool tip handling. * @param extension The extension * @since jEdit 4.0pre4 */ public void addExtension(TextAreaExtension extension) { extensionMgr.addExtension(DEFAULT_LAYER,extension); repaint(); } //}}} //{{{ addExtension() method /** * Adds a text area extension, which can perform custom painting and * tool tip handling. * @param layer The layer to add the extension to. Note that more than * extension can share the same layer. * @param extension The extension * @since jEdit 4.0pre4 */ public void addExtension(int layer, TextAreaExtension extension) { extensionMgr.addExtension(layer,extension); repaint(); } //}}} //{{{ removeExtension() method /** * Removes a text area extension. It will no longer be asked to * perform custom painting and tool tip handling. * @param extension The extension * @since jEdit 4.0pre4 */ public void removeExtension(TextAreaExtension extension) { extensionMgr.removeExtension(extension); repaint(); } //}}} //{{{ getExtensions() method /** * Returns an array of registered text area extensions. Useful for * debugging purposes. * @since jEdit 4.1pre5 */ public TextAreaExtension[] getExtensions() { return extensionMgr.getExtensions(); } //}}} //{{{ getToolTipText() method /** * Returns the tool tip to display at the specified location. * @param evt The mouse event */ @Override public String getToolTipText(MouseEvent evt) { if(textArea.getBuffer().isLoading()) return null; return extensionMgr.getToolTipText(evt.getX(),evt.getY()); } //}}} //{{{ getFontMetrics() method /** * Returns the font metrics used by this component. */ public FontMetrics getFontMetrics() { return fm; } //}}} //{{{ setFont() method /** * Sets the font for this component. This is overridden to update the * cached font metrics and to recalculate which lines are visible. * @param font The font */ @Override public void setFont(Font font) { super.setFont(font); fm = getFontMetrics(font); textArea.recalculateVisibleLines(); if(textArea.getBuffer() != null && !textArea.getBuffer().isLoading()) textArea.recalculateLastPhysicalLine(); textArea.propertiesChanged(); } //}}} //{{{ getStringWidth() method /** * Returns the width of the given string, in pixels, using the text * area's current font. * * @since jEdit 4.2final */ public float getStringWidth(String str) { if(textArea.charWidth != 0) return textArea.charWidth * str.length(); else { return (float)getFont().getStringBounds( str,getFontRenderContext()).getWidth(); } } //}}} //{{{ update() method /** * Repaints the text. * @param _gfx The graphics context */ @Override public void update(Graphics _gfx) { paint(_gfx); } //}}} //{{{ paint() method /** * Repaints the text. * @param _gfx The graphics context */ @Override public void paint(Graphics _gfx) { Graphics2D gfx = textArea.repaintMgr.getGraphics(); gfx.setRenderingHints(renderingHints); fontRenderContext = gfx.getFontRenderContext(); Rectangle clipRect = _gfx.getClipBounds(); JEditBuffer buffer = textArea.getBuffer(); int lineHeight = fm.getHeight(); if(lineHeight == 0 || buffer.isLoading()) { _gfx.setColor(getBackground()); _gfx.fillRect(clipRect.x,clipRect.y,clipRect.width,clipRect.height); } else { long prepareTime = System.currentTimeMillis(); FastRepaintManager.RepaintLines lines = textArea.repaintMgr.prepareGraphics(clipRect, textArea.getFirstLine(),gfx); prepareTime = (System.currentTimeMillis() - prepareTime); long linesTime = System.currentTimeMillis(); int numLines = (lines.last - lines.first + 1); int y = lines.first * lineHeight; gfx.fillRect(0,y,getWidth(),numLines * lineHeight); extensionMgr.paintScreenLineRange(textArea,gfx, lines.first,lines.last,y,lineHeight); linesTime = (System.currentTimeMillis() - linesTime); textArea.repaintMgr.setFastScroll( clipRect.equals(new Rectangle(0,0, getWidth(),getHeight()))); long blitTime = System.currentTimeMillis(); textArea.repaintMgr.paint(_gfx); blitTime = (System.currentTimeMillis() - blitTime); if(Debug.PAINT_TIMER && numLines >= 1) Log.log(Log.DEBUG,this,"repainting " + numLines + " lines took " + prepareTime + "/" + linesTime + "/" + blitTime + " ms"); } textArea.updateMaxHorizontalScrollWidth(); } //}}} //{{{ nextTabStop() method /** * Implementation of TabExpander interface. Returns next tab stop after * a specified point. * @param x The x co-ordinate * @param tabOffset Ignored * @return The next tab stop after <i>x</i> */ public float nextTabStop(float x, int tabOffset) { int ntabs = (int)(x / textArea.tabSize); return (ntabs + 1) * textArea.tabSize; } //}}} //{{{ getPreferredSize() method /** * Returns the painter's preferred size. */ @Override public Dimension getPreferredSize() { Dimension dim = new Dimension(); char[] foo = new char[80]; for(int i = 0; i < foo.length; i++) foo[i] = ' '; dim.width = (int)getStringWidth(new String(foo)); dim.height = fm.getHeight() * 25; return dim; } //}}} //{{{ getMinimumSize() method /** * Returns the painter's minimum size. */ @Override public Dimension getMinimumSize() { return getPreferredSize(); } //}}} //{{{ Package-private members //{{{ Instance variables /* package-private since they are accessed by inner classes and we * want this to be fast */ TextArea textArea; SyntaxStyle[] styles; Color caretColor; Color selectionColor; Color multipleSelectionColor; Color lineHighlightColor; Color structureHighlightColor; Color eolMarkerColor; Color wrapGuideColor; SyntaxStyle[] foldLineStyle; boolean blockCaret; boolean thickCaret; boolean lineHighlight; boolean structureHighlight; boolean eolMarkers; boolean wrapGuide; AntiAlias antiAlias; boolean fracFontMetrics; // should try to use this as little as possible. FontMetrics fm; //}}} //{{{ TextAreaPainter constructor /** * Creates a new painter. Do not create instances of this class * directly. */ TextAreaPainter(TextArea textArea) { enableEvents(AWTEvent.FOCUS_EVENT_MASK | AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK); this.textArea = textArea; antiAlias = new AntiAlias(0); fonts = new HashMap(); extensionMgr = new ExtensionManager(); setAutoscrolls(true); setOpaque(true); setRequestFocusEnabled(false); setDoubleBuffered(false); setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)); fontRenderContext = new FontRenderContext(null,false,false); addExtension(LINE_BACKGROUND_LAYER,new PaintLineBackground()); addExtension(SELECTION_LAYER,new PaintSelection()); addExtension(WRAP_GUIDE_LAYER,new PaintWrapGuide()); addExtension(BRACKET_HIGHLIGHT_LAYER,new StructureMatcher .Highlight(textArea)); addExtension(TEXT_LAYER,new PaintText()); caretExtension = new PaintCaret(); } //}}} //}}} //{{{ Private members //{{{ Instance variables private final ExtensionManager extensionMgr; private final PaintCaret caretExtension; private RenderingHints renderingHints; private FontRenderContext fontRenderContext; private final Map fonts; //}}} private static Object sm_hrgbRender = null; private static Constructor sm_frcConstructor = null; static { try { Field f = RenderingHints.class.getField("VALUE_TEXT_ANTIALIAS_LCD_HRGB"); sm_hrgbRender = f.get(null); Class[] fracFontMetricsTypeList = new Class[] {AffineTransform.class, Object.class, Object.class}; sm_frcConstructor = FontRenderContext.class.getConstructor(fracFontMetricsTypeList); } catch (NullPointerException npe) {} catch (SecurityException se) {} catch (NoSuchFieldException nsfe) {} catch (IllegalArgumentException iae) {} catch (IllegalAccessException iae) {} catch (NoSuchMethodException nsme) {} } //{{{ updateRenderingHints() method private void updateRenderingHints() { Map<RenderingHints.Key,Object> hints = new HashMap<RenderingHints.Key,Object>(); hints.put(RenderingHints.KEY_FRACTIONALMETRICS, fracFontMetrics ? RenderingHints.VALUE_FRACTIONALMETRICS_ON : RenderingHints.VALUE_FRACTIONALMETRICS_OFF); if (antiAlias.val() == 0) { hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); } /** LCD HRGB mode - works with JRE 1.6 only, which is why we use reflection */ else if (antiAlias.val() == 2 && sm_hrgbRender != null ) { hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, sm_hrgbRender); Object fontRenderHint = fracFontMetrics ? RenderingHints.VALUE_FRACTIONALMETRICS_ON : RenderingHints.VALUE_FRACTIONALMETRICS_OFF; Object[] paramList = new Object[] {null, sm_hrgbRender, fontRenderHint}; try { fontRenderContext = (FontRenderContext) sm_frcConstructor.newInstance(paramList); } catch (Exception e) { fontRenderContext = new FontRenderContext(null, antiAlias.val() > 0, fracFontMetrics); } } else /** Standard Antialias Version */ { hints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); fontRenderContext = new FontRenderContext(null, antiAlias.val() > 0, fracFontMetrics); } renderingHints = new RenderingHints(hints); } //}}} //}}} //{{{ Inner classes //{{{ PaintLineBackground class class PaintLineBackground extends TextAreaExtension { //{{{ shouldPaintLineHighlight() method private boolean shouldPaintLineHighlight(int caret, int start, int end) { if(!isLineHighlightEnabled() || caret < start || caret >= end) { return false; } int count = textArea.getSelectionCount(); if(count == 1) { Selection s = textArea.getSelection(0); return s.getStartLine() == s.getEndLine(); } else return (count == 0); } //}}} //{{{ paintValidLine() method @Override public void paintValidLine(Graphics2D gfx, int screenLine, int physicalLine, int start, int end, int y) { // minimise access$ methods TextArea textArea = TextAreaPainter.this.textArea; JEditBuffer buffer = textArea.getBuffer(); //{{{ Paint line highlight and collapsed fold highlight boolean collapsedFold = (physicalLine < buffer.getLineCount() - 1 && buffer.isFoldStart(physicalLine) && !textArea.displayManager .isLineVisible(physicalLine + 1)); SyntaxStyle foldLineStyle = null; if(collapsedFold) { int level = buffer.getFoldLevel(physicalLine + 1); if(buffer.getFoldHandler() instanceof IndentFoldHandler) level = Math.max(1,level / buffer.getIndentSize()); if(level > 3) level = 0; foldLineStyle = TextAreaPainter.this.foldLineStyle[level]; } int caret = textArea.getCaretPosition(); boolean paintLineHighlight = shouldPaintLineHighlight( caret,start,end); Color bgColor; if(paintLineHighlight) bgColor = lineHighlightColor; else if(collapsedFold) { bgColor = foldLineStyle.getBackgroundColor(); if(bgColor == null) bgColor = getBackground(); } else bgColor = getBackground(); if(paintLineHighlight || collapsedFold) { gfx.setColor(bgColor); gfx.fillRect(0,y,getWidth(),fm.getHeight()); } //}}} //{{{ Paint token backgrounds ChunkCache.LineInfo lineInfo = textArea.chunkCache .getLineInfo(screenLine); if(lineInfo.chunks != null) { float baseLine = y + fm.getHeight() - fm.getLeading() - fm.getDescent(); Chunk.paintChunkBackgrounds( lineInfo.chunks,gfx, textArea.getHorizontalOffset(), baseLine); } //}}} } //}}} } //}}} //{{{ PaintSelection class class PaintSelection extends TextAreaExtension { //{{{ paintValidLine() method @Override public void paintValidLine(Graphics2D gfx, int screenLine, int physicalLine, int start, int end, int y) { if(textArea.getSelectionCount() == 0) return; gfx.setColor(textArea.isMultipleSelectionEnabled() ? getMultipleSelectionColor() : getSelectionColor()); Iterator<Selection> iter = textArea.getSelectionIterator(); while(iter.hasNext()) { Selection s = iter.next(); paintSelection(gfx,screenLine,physicalLine,y,s); } } //}}} //{{{ paintSelection() method private void paintSelection(Graphics2D gfx, int screenLine, int physicalLine, int y, Selection s) { int[] selectionStartAndEnd = textArea.selectionManager .getSelectionStartAndEnd( screenLine,physicalLine,s); if(selectionStartAndEnd == null) return; int x1 = selectionStartAndEnd[0]; int x2 = selectionStartAndEnd[1]; gfx.fillRect(x1,y,x2 - x1,fm.getHeight()); } //}}} } //}}} //{{{ PaintWrapGuide class class PaintWrapGuide extends TextAreaExtension { @Override public void paintScreenLineRange(Graphics2D gfx, int firstLine, int lastLine, int[] physicalLines, int[] start, int[] end, int y, int lineHeight) { if(textArea.wrapMargin != 0 && !textArea.wrapToWidth && isWrapGuidePainted()) { gfx.setColor(getWrapGuideColor()); int x = textArea.getHorizontalOffset() + textArea.wrapMargin; gfx.drawLine(x,y,x,y + (lastLine - firstLine + 1) * lineHeight); } } @Override public String getToolTipText(int x, int y) { if(textArea.wrapMargin != 0 && !textArea.wrapToWidth && isWrapGuidePainted()) { int wrapGuidePos = textArea.wrapMargin + textArea.getHorizontalOffset(); if(Math.abs(x - wrapGuidePos) < 5) { return String.valueOf(textArea.getBuffer() .getProperty("maxLineLen")); } } return null; } } //}}} //{{{ PaintText class class PaintText extends TextAreaExtension { @Override public void paintValidLine(Graphics2D gfx, int screenLine, int physicalLine, int start, int end, int y) { ChunkCache.LineInfo lineInfo = textArea.chunkCache .getLineInfo(screenLine); Font defaultFont = getFont(); Color defaultColor = getForeground(); gfx.setFont(defaultFont); gfx.setColor(defaultColor); int x = textArea.getHorizontalOffset(); int originalX = x; float baseLine = y + fm.getHeight() - fm.getLeading() - fm.getDescent(); if(lineInfo.chunks != null) { x += Chunk.paintChunkList(lineInfo.chunks, gfx,textArea.getHorizontalOffset(), baseLine,!Debug.DISABLE_GLYPH_VECTOR); } JEditBuffer buffer = textArea.getBuffer(); if(!lineInfo.lastSubregion) { gfx.setFont(defaultFont); gfx.setColor(eolMarkerColor); gfx.drawString(":",Math.max(x, textArea.getHorizontalOffset() + textArea.wrapMargin + textArea.charWidth), baseLine); x += textArea.charWidth; } else if(physicalLine < buffer.getLineCount() - 1 && buffer.isFoldStart(physicalLine) && !textArea.displayManager .isLineVisible(physicalLine + 1)) { int level = buffer.getFoldLevel(physicalLine + 1); if(buffer.getFoldHandler() instanceof IndentFoldHandler) level = Math.max(1,level / buffer.getIndentSize()); if(level > 3) level = 0; SyntaxStyle foldLineStyle = TextAreaPainter.this.foldLineStyle[level]; Font font = foldLineStyle.getFont(); gfx.setFont(font); gfx.setColor(foldLineStyle.getForegroundColor()); int nextLine; int nextScreenLine = screenLine + 1; if(nextScreenLine < textArea.getVisibleLines()) { nextLine = textArea.chunkCache.getLineInfo(nextScreenLine) .physicalLine; } else { nextLine = textArea.displayManager .getNextVisibleLine(physicalLine); } if(nextLine == -1) nextLine = textArea.getLineCount(); int count = nextLine - physicalLine - 1; String str = " [" + count + " lines]"; float width = getStringWidth(str); gfx.drawString(str,x,baseLine); x += width; } else if(eolMarkers) { gfx.setFont(defaultFont); gfx.setColor(eolMarkerColor); gfx.drawString(".",x,baseLine); x += textArea.charWidth; } lineInfo.width = (x - originalX); } } //}}} //{{{ PaintCaret class class PaintCaret extends TextAreaExtension { @Override public void paintValidLine(Graphics2D gfx, int screenLine, int physicalLine, int start, int end, int y) { if(!textArea.isCaretVisible()) return; int caret = textArea.getCaretPosition(); if(caret < start || caret >= end) return; int offset = caret - textArea.getLineStartOffset(physicalLine); textArea.offsetToXY(physicalLine, offset, textArea.offsetXY); int caretX = textArea.offsetXY.x; int lineHeight = fm.getHeight(); gfx.setColor(caretColor); if(textArea.isOverwriteEnabled()) { gfx.drawLine(caretX,y + lineHeight - 1, caretX + textArea.charWidth, y + lineHeight - 1); } else if(blockCaret) gfx.drawRect(caretX,y,textArea.charWidth - 1, lineHeight - 1); else { if (thickCaret) gfx.drawRect(caretX, y, 1, lineHeight - 1); else gfx.drawLine(caretX,y, caretX,y + lineHeight - 1); } } } //}}} //}}} }

The table below shows all metrics for TextAreaPainter.java.

MetricValueDescription
BLOCKS97.00Number of blocks
BLOCK_COMMENT23.00Number of block comment lines
COMMENTS416.00Comment lines
COMMENT_DENSITY 0.73Comment density
COMPARISONS76.00Number of comparison operators
CYCLOMATIC135.00Cyclomatic complexity
DECL_COMMENTS147.00Comments in declarations
DOC_COMMENT309.00Number of javadoc comment lines
ELOC573.00Effective lines of code
EXEC_COMMENTS 5.00Comments in executable code
EXITS111.00Procedure exits
FUNCTIONS62.00Number of function declarations
HALSTEAD_DIFFICULTY78.97Halstead difficulty
HALSTEAD_EFFORT 0.00Halstead effort
INTERFACE_COMPLEXITY148.00Interface complexity
JAVA0001 0.00JAVA0001 Package name does not contain only lower case letters
JAVA0002 0.00JAVA0002 Package name does not begin with a top level domain name or country code
JAVA0003 0.00JAVA0003 Minimize use of on-demand (.*) imports
JAVA0004 0.00JAVA0004 Unnecessary import from java.lang
JAVA0005 1.00JAVA0005 Imports not in specified order
JAVA0006 0.00JAVA0006 Empty finally block
JAVA0007 0.00JAVA0007 Should not declare public field
JAVA0008 6.00JAVA0008 Empty catch block
JAVA0009 0.00JAVA0009 Protected member in final class
JAVA0010 0.00JAVA0010 Non-instantiable class does not contain a non-private static member
JAVA0011 0.00JAVA0011 Abstract class does not contain an abstract method
JAVA0012 0.00JAVA0012 Non-constructor method with same name as declaring class
JAVA0013 0.00JAVA0013 Non-blank final field is not static
JAVA0014 0.00JAVA0014 Class with only static members has non-private constructor
JAVA0015 0.00JAVA0015 Package class contains public nested type
JAVA0016 0.00JAVA0016 Abstract class contains public constructor
JAVA0017 0.00JAVA0017 Class name does not have required form
JAVA0018 0.00JAVA0018 Method name does not have required form
JAVA0019 0.00JAVA0019 Interface name does not have required form
JAVA0020 0.00JAVA0020 Field name does not have required form
JAVA0021 0.00JAVA0021 Interface method name does not have required form
JAVA0022 0.00JAVA0022 Static final field name does not have required form
JAVA0023 0.00JAVA0023 Empty finalize method
JAVA0024 0.00JAVA0024 Empty class
JAVA0025 0.00JAVA0025 Method override is empty
JAVA0026 0.00JAVA0026 Finalize method with parameters
JAVA0029 0.00JAVA0029 Private method not used
JAVA0030 0.00JAVA0030 Private field not used
JAVA0031 0.00JAVA0031 Case statement not properly closed
JAVA0032 0.00JAVA0032 Switch statement missing default
JAVA0033 0.00JAVA0033 default: not last case in switch statement
JAVA003427.00JAVA0034 Missing braces in if statement
JAVA0035 1.00JAVA0035 Missing braces in for statement
JAVA0036 0.00JAVA0036 Missing braces in while statement
JAVA0038 0.00JAVA0038 Non-case label in switch statement
JAVA0039 0.00JAVA0039 Break statement with label
JAVA0040 0.00JAVA0040 Switch statement contains N cases (maximum: M)
JAVA0041 0.00JAVA0041 Nested synchronized block
JAVA0042 0.00JAVA0042 Empty synchronized statement
JAVA0043 0.00JAVA0043 Inner class does not use outer class
JAVA0044 0.00JAVA0044 Serializable class with no instance variables
JAVA0045 0.00JAVA0045 Serializable class with only transient fields
JAVA0046 0.00JAVA0046 Name of class not derived from Exception ends with 'Exception'
JAVA0047 0.00JAVA0047 Serializable class derives from invalid base class
JAVA0048 0.00JAVA0048 Name of class derived from Exception does not end with 'Exception'
JAVA0049 0.00JAVA0049 Nested block at depth N (maximum: M)
JAVA0050 0.00JAVA0050 Class derives from java.lang.Error
JAVA0051 0.00JAVA0051 Class derives from java.lang.RuntimeException
JAVA0052 0.00JAVA0052 Class derives from java.lang.Throwable
JAVA0053 0.00JAVA0053 Unused label
JAVA0054 0.00JAVA0054 Inheritance depth N exceeds maximum M
JAVA0055 0.00JAVA0055 Class should be interface
JAVA0056 0.00JAVA0056 Unnecessary abstract modifier for interface or annotation
JAVA0057 0.00JAVA0057 Unnecessary default constructor
JAVA0058 0.00JAVA0058 Constructor calls super()
JAVA0059 0.00JAVA0059 Method override only calls super()
JAVA0061 0.00JAVA0061 Inaccessible member in anonymous class
JAVA0062 0.00JAVA0062 Public class missing public member or protected constructor
JAVA0063 0.00JAVA0063 Identifier name should not contain '$'
JAVA0064 0.00JAVA0064 N variations of identifier name (maximum: M)
JAVA0065 0.00JAVA0065 Unnecessary final modifier for method in final class
JAVA0066 0.00JAVA0066 Unnecessary modifier for interface nested type
JAVA0067 0.00JAVA0067 Array descriptor on identifier name
JAVA0068 0.00JAVA0068 Modifiers not declared in recommended order
JAVA0071 0.00JAVA0071 Strings compared with ==
JAVA0073 0.00JAVA0073 Integer division in floating-point context
JAVA0074 0.00JAVA0074 Use of Object.notify()
JAVA0075 0.00JAVA0075 Method parameter hides field
JAVA0076 0.00JAVA0076 Use of magic number
JAVA0077 0.00JAVA0077 Private field not used in declaring class
JAVA0078 0.00JAVA0078 Floating point values compared with ==
JAVA0079 0.00JAVA0079 Use of instance to reference static member
JAVA0080 0.00JAVA0080 Import declaration not used
JAVA0081 0.00JAVA0081 Boolean literal in comparison
JAVA0082 0.00JAVA0082 Unnecessary widening cast
JAVA0083 0.00JAVA0083 Unnecessary instanceof test
JAVA0084 0.00JAVA0084 Should use compound assignment operator
JAVA0085 0.00JAVA0085 Use of sun.* class
JAVA0087 0.00JAVA0087 Use of Thread.sleep()
JAVA0089 0.00JAVA0089 Use of restricted package
JAVA0092 0.00JAVA0092 Use of restricted type
JAVA0093 0.00JAVA0093 Redundant assignment
JAVA0094 0.00JAVA0094 Field hides a superclass field
JAVA0095 0.00JAVA0095 Uninitialized private field
JAVA0096 0.00JAVA0096 Field in nested class hides outer field
JAVA0098 1.00JAVA0098 Minimize use of implicit field initializers
JAVA0100 1.00JAVA0100 Class contains N non-final fields (maximum: M)
JAVA0101 0.00JAVA0101 Unnecessary modifier for field in interface
JAVA0102 0.00JAVA0102 Last statement in finalize() not super.finalize()
JAVA0103 0.00JAVA0103 Explicit call to finalize()
JAVA0104 0.00JAVA0104 finalize() only calls super.finalize()
JAVA0105 0.00JAVA0105 Duplicate import declaration
JAVA0106 0.00JAVA0106 Unnecessary import from current package
JAVA0108 5.00JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0109 0.00JAVA0109 Incorrect javadoc: no parameter 'parameter'
JAVA011024.00JAVA0110 Incorrect javadoc: no @return tag
JAVA0111 0.00JAVA0111 Incorrect javadoc: @return tag for void method
JAVA0112 0.00JAVA0112 Incorrect javadoc: no exception 'exception' in throws
JAVA0113 0.00JAVA0113 Incorrect javadoc: no @author tag
JAVA0114 0.00JAVA0114 Incorrect javadoc: no @version tag
JAVA0115 0.00JAVA0115 Incorrect javadoc: no @throws or @exception tag for 'exception'
JAVA0116 0.00JAVA0116 Missing javadoc: field 'field'
JAVA0117 0.00JAVA0117 Missing javadoc: method 'method'
JAVA0118 0.00JAVA0118 Missing javadoc: type 'type'
JAVA0119 0.00JAVA0119 Control variable changed within body of for loop
JAVA0123 0.00JAVA0123 Use all three components of for loop
JAVA0125 0.00JAVA0125 Continue statement with label
JAVA0126 0.00JAVA0126 Method declares unchecked exception in throws
JAVA0128 0.00JAVA0128 Public constructor in non-public class
JAVA0130 0.00JAVA0130 Non-static method does not use instance fields
JAVA0131 0.00JAVA0131 Compatible method does not override base
JAVA0132 0.00JAVA0132 Method overload with compatible signature
JAVA0133 0.00JAVA0133 Non-synchronized method overrides synchronized method
JAVA0135 0.00JAVA0135 Only one of Object.equals and Object.hashCode defined: missing 'method'
JAVA0136 1.00JAVA0136 N methods defined in class (maximum: M)
JAVA0137 0.00JAVA0137 Non-abstract class missing constructor
JAVA0138 5.00JAVA0138 N parameters defined for method (maximum: M)
JAVA0139 0.00JAVA0139 Definition of main other than public static void main(java.lang.String[])
JAVA0141 0.00JAVA0141 Unnecessary modifier for method in interface
JAVA0143 0.00JAVA0143 Synchronized method
JAVA0144 1.00JAVA0144 Line exceeds maximum M characters
JAVA01451966.00JAVA0145 Tab character used in source file
JAVA0150 0.00JAVA0150 java.lang.Error (or subclass) thrown
JAVA0153 0.00JAVA0153 Inefficient conversion of integer to string
JAVA0159 0.00JAVA0159 Inefficient conversion of string to integer
JAVA0160 0.00JAVA0160 Method does not throw specified exception
JAVA0161 0.00JAVA0161 Conditional wait() not in loop
JAVA0163 0.00JAVA0163 Empty statement
JAVA0165 0.00JAVA0165 Conflicting return statement in finally block
JAVA0166 1.00JAVA0166 Generic exception caught
JAVA0167 0.00JAVA0167 ThreadDeath not rethrown
JAVA0169 0.00JAVA0169 Unnecessary catch block: exception 'exception'
JAVA0170 0.00JAVA0170 Caught exception not derived from java.lang.Exception
JAVA0171 0.00JAVA0171 Unused local variable
JAVA0173 0.00JAVA0173 Unused method parameter
JAVA0174 0.00JAVA0174 Assigned local variable never used
JAVA0175 0.00JAVA0175 Successive assignment to variable
JAVA0176 0.00JAVA0176 Local variable name does not have required form
JAVA0177 2.00JAVA0177 Variable declaration missing initializer
JAVA0179 3.00JAVA0179 Local variable hides visible field
JAVA0233 0.00JAVA0233 Definition of serialVersionUID other than 'private static final long serialVersionUID'
JAVA0234 1.00JAVA0234 Class is Serializable but does not define serialVersionUID
JAVA0235 0.00JAVA0235 Class defines serialVersionUID but does not implement Serializable
JAVA0236 0.00JAVA0236 Attempt to clone an object which does not implement Cloneable
JAVA0237 0.00JAVA0237 Class implements Cloneable but does not have public clone method
JAVA0238 0.00JAVA0238 Clone method does not call super.clone()
JAVA0239 0.00JAVA0239 Class declares 'readObject' or 'writeObject' but does not implement Serializable
JAVA0240 0.00JAVA0240 Serializable class which declares readObject or writeObject but not both
JAVA0241 0.00JAVA0241 'readObject' or 'writeObject' should be declared private in Serializable class
JAVA0242 0.00JAVA0242 Transient field in non-Serializable class
JAVA0243 0.00JAVA0243 'readResolve' or 'writeReplace' should be declared private or protected
JAVA0244 0.00JAVA0244 Field or method name in subclass differs only by case from inherited field or method
JAVA0245 0.00JAVA0245 JUnit TestCase with non-trivial constructor
JAVA0246 0.00JAVA0246 JUnit assertXXX statement missing message parameter
JAVA0247 0.00JAVA0247 JUnit 'setUp()' and 'tearDown()' should call super method
JAVA0248 0.00JAVA0248 JUnit method 'setUp' or 'tearDown' with incorrect signature
JAVA0249 0.00JAVA0249 JUnit TestCase 'suite()' should be declared static
JAVA0250 0.00JAVA0250 JUnit TestCase declares testXXX method with incorrect signature
JAVA0251 0.00JAVA0251 Use '%n' for line breaks in printf/format for platform independence
JAVA0252 0.00JAVA0252 'enum' is a Java 1.5 reserved word
JAVA0253 0.00JAVA0253 Not all enum constants consumed in switch statement
JAVA0254 1.00JAVA0254 Use enhanced for loop construct instead of Iterator
JAVA0255 0.00JAVA0255 Result of method invocation not used
JAVA0256 2.00JAVA0256 Assignment of external collection/array to field
JAVA0257 0.00JAVA0257 Use of 'Constant Interface' anti-pattern
JAVA0258 0.00JAVA0258 Implement Iterable for foreach compatibility
JAVA0259 2.00JAVA0259 Return of collection/array field
JAVA0260 0.00JAVA0260 Use 'enum' instead of Enumerated Type pattern
JAVA0261 0.00JAVA0261 Use specialized Enum collection types
JAVA0262 0.00JAVA0262 Use of char in integer context
JAVA0263 0.00JAVA0263 Long literal ends with 'l' instead of 'L'
JAVA0264 0.00JAVA0264 Integer math in long context - check for overflow
JAVA0265 0.00JAVA0265 Use of Throwable.printStackTrace()
JAVA0266 0.00JAVA0266 Use of System.out
JAVA0267 0.00JAVA0267 Use of System.err
JAVA0269 0.00JAVA0269 Contents of StringBuffer never used
JAVA0270 0.00JAVA0270 Use Java 5.0 enhanced for loop construct to iterate over all elements in an array
JAVA0271 0.00JAVA0271 Minimize use of on-demand (.*) static imports
JAVA0272 0.00JAVA0272 Thread.run() called
JAVA0273 0.00JAVA0273 Non-final derivative of Thread calls start() in constructor
JAVA0274 0.00JAVA0274 Serializable class has a synchronized readObject()
JAVA0275 0.00JAVA0275 Serializable class has a synchronized writeObject() and no other synchronized methods
JAVA0276 0.00JAVA0276 Unnecessary use of String constructor
JAVA0277 0.00JAVA0277 Iterator.next() implementation does not throw NoSuchElementException
JAVA0278 0.00JAVA0278 Unnecessary use of Boolean constructor
JAVA0279 0.00JAVA0279 Serialization method readObject or readObjectNoData calls an overridable method
JAVA0280 0.00JAVA0280 IllegalMonitorStateException caught
JAVA0281 0.00JAVA0281 Iterator.next() not called in loop
JAVA0282 0.00JAVA0282 Call to Iterator.next() in loop which does not test Iterator.hasNext()
JAVA0283 0.00JAVA0283 Control variable not updated in loop body
JAVA0284 0.00JAVA0284 Explicit garbage collection
JAVA0285 1.00JAVA0285 Dereference of potentially null variable
JAVA0286 0.00JAVA0286 Dereference of null variable
JAVA0287 0.00JAVA0287 Unnecessary null check
JAVA0288 0.00JAVA0288 Inconsistent null check
LINES1267.00Number of lines in the source file
LINE_COMMENT84.00Number of line comments
LOC701.00Lines of code
LOGICAL_LINES300.00Number of statements
LOOPS 2.00Number of loops
NEST_DEPTH 3.00Maximum nesting depth
OPERANDS1366.00Number of operands
OPERATORS2600.00Number of operators
PARAMS76.00Number of formal parameter declarations
PROGRAM_LENGTH3966.00Halstead program length
PROGRAM_VOCAB550.00Halstead program vocabulary
PROGRAM_VOLUME 0.00Halstead program volume
RETURNS72.00Number of return points from functions
SIZE32663.00Size of the file in bytes
UNIQUE_OPERANDS493.00Number of unique operands
UNIQUE_OPERATORS57.00Number of unique operators
WHITESPACE150.00Number of whitespace lines