fb-contrib-commit Mailing List for fb-contrib (Page 64)
Brought to you by:
dbrosius
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(56) |
Oct
(60) |
Nov
(58) |
Dec
(89) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(66) |
Feb
(55) |
Mar
(85) |
Apr
(115) |
May
(35) |
Jun
(28) |
Jul
(3) |
Aug
(48) |
Sep
(37) |
Oct
(22) |
Nov
(14) |
Dec
(66) |
2007 |
Jan
(45) |
Feb
(63) |
Mar
(10) |
Apr
(1) |
May
(1) |
Jun
(12) |
Jul
|
Aug
|
Sep
(25) |
Oct
(21) |
Nov
(39) |
Dec
|
2008 |
Jan
(7) |
Feb
|
Mar
(26) |
Apr
(5) |
May
(2) |
Jun
(32) |
Jul
(9) |
Aug
(10) |
Sep
|
Oct
(3) |
Nov
(1) |
Dec
|
2009 |
Jan
(10) |
Feb
(31) |
Mar
(32) |
Apr
(35) |
May
(25) |
Jun
|
Jul
(31) |
Aug
(10) |
Sep
(95) |
Oct
(35) |
Nov
(10) |
Dec
(34) |
2010 |
Jan
(90) |
Feb
(4) |
Mar
(7) |
Apr
(20) |
May
(20) |
Jun
(13) |
Jul
(7) |
Aug
(18) |
Sep
(25) |
Oct
(4) |
Nov
(16) |
Dec
(2) |
2011 |
Jan
(1) |
Feb
|
Mar
(11) |
Apr
(3) |
May
(2) |
Jun
(26) |
Jul
(10) |
Aug
(2) |
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(1) |
2012 |
Jan
(3) |
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(14) |
Nov
(3) |
Dec
(4) |
2013 |
Jan
(3) |
Feb
(2) |
Mar
(1) |
Apr
(4) |
May
|
Jun
(1) |
Jul
(3) |
Aug
|
Sep
|
Oct
(4) |
Nov
(3) |
Dec
(3) |
2014 |
Jan
(4) |
Feb
(2) |
Mar
(4) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(3) |
Dec
(3) |
2016 |
Jan
(2) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
(2) |
Nov
(7) |
Dec
|
2017 |
Jan
(1) |
Feb
|
Mar
(4) |
Apr
(5) |
May
(2) |
Jun
|
Jul
(2) |
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
(3) |
2018 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
(5) |
Jun
(2) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Dave B. <dbr...@us...> - 2006-02-03 03:45:29
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31704/src/com/mebigfatguy/fbcontrib/detect Modified Files: SluggishGui.java Log Message: parse non listener methods for expensive code, and then parse listener methods. If one of these aux methods is called, then report the listener as sluggish. Index: SluggishGui.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- SluggishGui.java 2 Feb 2006 07:05:02 -0000 1.3 +++ SluggishGui.java 3 Feb 2006 03:45:20 -0000 1.4 @@ -19,12 +19,13 @@ package com.mebigfatguy.fbcontrib.detect; import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.Map; import java.util.Set; import org.apache.bcel.classfile.Code; import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.classfile.Method; -import org.apache.bcel.generic.Type; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; @@ -68,7 +69,11 @@ } private BugReporter bugReporter; + private Set<String> expensiveThisCalls = new HashSet<String>(); private Set<JavaClass> guiInterfaces = new HashSet<JavaClass>(); + private Map<Code,Method> listenerCode = new LinkedHashMap<Code,Method>(); + private String methodName; + private String methodSig; private boolean isListenerMethod = false; private boolean methodReported = false; @@ -100,6 +105,8 @@ public void visitClassContext(ClassContext classContext) { try { guiInterfaces.clear(); + listenerCode.clear(); + expensiveThisCalls.clear(); JavaClass cls = classContext.getJavaClass(); JavaClass[] infs = cls.getAllInterfaces(); for (JavaClass inf : infs) { @@ -119,50 +126,52 @@ } /** - * overrides the visitor to find methods that override listeners + * overrides the visitor to visit all of the collected listener methods + * + * @parm obj the context object of the currently parsed class + */ + @Override + public void visitAfter(JavaClass obj) { + isListenerMethod = true; + for (Code l : listenerCode.keySet()) { + methodReported = false; + super.visitCode(l); + } + super.visitAfter(obj); + } + /** + * overrides the visitor collect method info * * @param obj the context object of the currently parsed method */ @Override public void visitMethod(Method obj) { - isListenerMethod = false; - methodReported = false; - if (!obj.isPublic()) - return; - - String methodSig = obj.getSignature(); - Type r = Type.getReturnType(methodSig); - if (!r.equals(Type.VOID)) - return; - Type[] args = Type.getArgumentTypes(methodSig); - if (args.length != 1) - return; - if (args[0].getSignature().charAt(0) != 'L') - return; - - String methodName = obj.getName(); + methodName = obj.getName(); + methodSig = obj.getSignature(); + } + + /** + * overrides the visitor to segregate method into two, those that implement + * listeners, and those that don't. The ones that don't are processed first. + * + * @param obj the context object of the currently parsed code block + */ + @Override + public void visitCode(Code obj) { for (JavaClass inf : guiInterfaces) { Method[] methods = inf.getMethods(); for (Method m : methods) { if (m.getName().equals(methodName)) { if (m.getSignature().equals(methodSig)) { - isListenerMethod = true; + listenerCode.put(obj, this.getMethod()); return; } } } } - } - - /** - * overrides the visitor to check whether to parse method if its a listener - * - * @param obj the context object of the currently parsed code block - */ - @Override - public void visitCode(Code obj) { - if (isListenerMethod) - super.visitCode(obj); + isListenerMethod = false; + methodReported = false; + super.visitCode(obj); } /** @@ -180,12 +189,18 @@ || (seen == INVOKESTATIC)) { String clsName = getClassConstantOperand(); String methodName = getNameConstantOperand(); - String info = clsName + ":" + methodName; - if (expensiveCalls.contains(info)) { - bugReporter.reportBug(new BugInstance(this, "SG_SLUGGISH_GUI", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLine(this)); + String methodInfo = clsName + ":" + methodName; + String methodSig = getSigConstantOperand(); + String thisMethodInfo = (clsName.equals(getClassName())) ? (methodName + ":" + methodSig) : "0"; + + if (expensiveCalls.contains(methodInfo) || expensiveThisCalls.contains(thisMethodInfo)) { + if (isListenerMethod) { + bugReporter.reportBug(new BugInstance(this, "SG_SLUGGISH_GUI", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this.getClassContext().getJavaClass(), listenerCode.get(this.getCode()))); + } else { + expensiveThisCalls.add(getMethodName() + ":" + getMethodSig()); + } methodReported = true; } } |
From: Dave B. <dbr...@us...> - 2006-02-03 03:45:29
|
Update of /cvsroot/fb-contrib/fb-contrib/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31704/samples Modified Files: SG_Sample.java Log Message: parse non listener methods for expensive code, and then parse listener methods. If one of these aux methods is called, then report the listener as sluggish. Index: SG_Sample.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/samples/SG_Sample.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SG_Sample.java 2 Feb 2006 06:18:02 -0000 1.1 +++ SG_Sample.java 3 Feb 2006 03:45:20 -0000 1.2 @@ -1,9 +1,19 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; +import java.io.ByteArrayInputStream; import java.io.FileReader; -public class SG_Sample implements ActionListener +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.w3c.dom.Document; + +public class SG_Sample implements ActionListener, WindowListener { + String s = "<xml/>"; + public void actionPerformed(ActionEvent ae) { FileReader fr = null; @@ -19,5 +29,48 @@ } } + + public void windowClosing(WindowEvent we) + { + String s = getRoot(); + } + + private String getRoot() + { + try + { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + Document d = db.parse(new ByteArrayInputStream(s.getBytes())); + return d.getDocumentElement().getNodeName(); + } + catch (Exception e) + { + return ""; + } + } + + public void windowActivated(WindowEvent arg0) + { + } + public void windowClosed(WindowEvent arg0) + { + } + + public void windowDeactivated(WindowEvent arg0) + { + } + + public void windowDeiconified(WindowEvent arg0) + { + } + + public void windowIconified(WindowEvent arg0) + { + } + + public void windowOpened(WindowEvent arg0) + { + } } |
From: Dave B. <dbr...@us...> - 2006-02-02 07:05:10
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27951/src/com/mebigfatguy/fbcontrib/detect Modified Files: SluggishGui.java Log Message: add loadclass, clean up some signatures Index: SluggishGui.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- SluggishGui.java 2 Feb 2006 06:52:08 -0000 1.2 +++ SluggishGui.java 2 Feb 2006 07:05:02 -0000 1.3 @@ -53,8 +53,9 @@ expensiveCalls.add("java/io/FileReader:<init>"); expensiveCalls.add("java/io/InputStreamReader:<init>"); expensiveCalls.add("java/io/RandomAccessFile:<init>"); - expensiveCalls.add("java/lang/Class:getResourceAsStream:<init>"); - expensiveCalls.add("java/lang/ClassLoader:getResourceAsStream:<init>"); + expensiveCalls.add("java/lang/Class:getResourceAsStream"); + expensiveCalls.add("java/lang/ClassLoader:getResourceAsStream"); + expensiveCalls.add("java/lang/ClassLoader:loadClass"); expensiveCalls.add("java/sql/DriverManager:getConnection"); expensiveCalls.add("java/sql/Connection:createStatement"); expensiveCalls.add("java/sql/Connection:prepareStatement"); |
From: Dave B. <dbr...@us...> - 2006-02-02 06:52:18
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23718/src/com/mebigfatguy/fbcontrib/detect Modified Files: SluggishGui.java Log Message: add xml major methods as expensive Index: SluggishGui.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SluggishGui.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SluggishGui.java 2 Feb 2006 06:18:02 -0000 1.1 +++ SluggishGui.java 2 Feb 2006 06:52:08 -0000 1.2 @@ -60,6 +60,10 @@ expensiveCalls.add("java/sql/Connection:prepareStatement"); expensiveCalls.add("java/sql/Connection:prepareCall"); expensiveCalls.add("javax/sql/DataSource:getConnection"); + expensiveCalls.add("javax/xml/parsers/DocumentBuilder:parse"); + expensiveCalls.add("javax/xml/parsers/DocumentBuilder:parse"); + expensiveCalls.add("javax/xml/parsers/SAXParser:parse"); + expensiveCalls.add("javax/xml/transform/Transformer:transform"); } private BugReporter bugReporter; |
From: Dave B. <dbr...@us...> - 2006-02-02 06:18:11
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12608/src/com/mebigfatguy/fbcontrib/detect Added Files: SluggishGui.java Log Message: new SG - initial checkin --- NEW FILE: SluggishGui.java --- /* * fb-contrib - Auxilliary detectors for Java programs * Copyright (C) 2005-2006 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package com.mebigfatguy.fbcontrib.detect; import java.util.HashSet; import java.util.Set; import org.apache.bcel.classfile.Code; import org.apache.bcel.classfile.JavaClass; import org.apache.bcel.classfile.Method; import org.apache.bcel.generic.Type; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.StatelessDetector; import edu.umd.cs.findbugs.ba.ClassContext; public class SluggishGui extends BytecodeScanningDetector implements StatelessDetector { private static final Set<String> expensiveCalls = new HashSet<String>(); static { expensiveCalls.add("java/io/BufferedOutputStream:<init>"); expensiveCalls.add("java/io/DataOutputStream:<init>"); expensiveCalls.add("java/io/FileOutputStream:<init>"); expensiveCalls.add("java/io/ObjectOutputStream:<init>"); expensiveCalls.add("java/io/PipedOutputStream:<init>"); expensiveCalls.add("java/io/BufferedInputStream:<init>"); expensiveCalls.add("java/io/DataInputStream:<init>"); expensiveCalls.add("java/io/FileInputStream:<init>"); expensiveCalls.add("java/io/ObjectInputStream:<init>"); expensiveCalls.add("java/io/PipedInputStream:<init>"); expensiveCalls.add("java/io/BufferedWriter:<init>"); expensiveCalls.add("java/io/FileWriter:<init>"); expensiveCalls.add("java/io/OutpuStreamWriter:<init>"); expensiveCalls.add("java/io/BufferedReader:<init>"); expensiveCalls.add("java/io/FileReader:<init>"); expensiveCalls.add("java/io/InputStreamReader:<init>"); expensiveCalls.add("java/io/RandomAccessFile:<init>"); expensiveCalls.add("java/lang/Class:getResourceAsStream:<init>"); expensiveCalls.add("java/lang/ClassLoader:getResourceAsStream:<init>"); expensiveCalls.add("java/sql/DriverManager:getConnection"); expensiveCalls.add("java/sql/Connection:createStatement"); expensiveCalls.add("java/sql/Connection:prepareStatement"); expensiveCalls.add("java/sql/Connection:prepareCall"); expensiveCalls.add("javax/sql/DataSource:getConnection"); } private BugReporter bugReporter; private Set<JavaClass> guiInterfaces = new HashSet<JavaClass>(); private boolean isListenerMethod = false; private boolean methodReported = false; /** * constructs a SG detector given the reporter to report bugs on * @param bugReporter the sync of bug reports */ public SluggishGui(BugReporter bugReporter) { this.bugReporter = bugReporter; } /** * clone this detector so that it can be a StatelessDetector * * @return a clone of this object */ @Override public Object clone() throws CloneNotSupportedException { return super.clone(); } /** * overrides the visitor to reset look for gui interfaces * * @param obj the context object for the currently parsed class */ @Override public void visitClassContext(ClassContext classContext) { try { guiInterfaces.clear(); JavaClass cls = classContext.getJavaClass(); JavaClass[] infs = cls.getAllInterfaces(); for (JavaClass inf : infs) { String name = inf.getClassName(); if ((name.startsWith("java.awt.") || name.startsWith("javax.swing.")) && name.endsWith("Listener")) { guiInterfaces.add(inf); } } if (guiInterfaces.size() > 0) super.visitClassContext(classContext); } catch (ClassNotFoundException cnfe) { bugReporter.reportMissingClass(cnfe); } } /** * overrides the visitor to find methods that override listeners * * @param obj the context object of the currently parsed method */ @Override public void visitMethod(Method obj) { isListenerMethod = false; methodReported = false; if (!obj.isPublic()) return; String methodSig = obj.getSignature(); Type r = Type.getReturnType(methodSig); if (!r.equals(Type.VOID)) return; Type[] args = Type.getArgumentTypes(methodSig); if (args.length != 1) return; if (args[0].getSignature().charAt(0) != 'L') return; String methodName = obj.getName(); for (JavaClass inf : guiInterfaces) { Method[] methods = inf.getMethods(); for (Method m : methods) { if (m.getName().equals(methodName)) { if (m.getSignature().equals(methodSig)) { isListenerMethod = true; return; } } } } } /** * overrides the visitor to check whether to parse method if its a listener * * @param obj the context object of the currently parsed code block */ @Override public void visitCode(Code obj) { if (isListenerMethod) super.visitCode(obj); } /** * overrides the visitor to look for the execution of expensive calls * * @param seen the currently parsed opcode */ public void sawOpcode(int seen) { if (methodReported) return; if ((seen == INVOKEINTERFACE) || (seen == INVOKEVIRTUAL) || (seen == INVOKESPECIAL) || (seen == INVOKESTATIC)) { String clsName = getClassConstantOperand(); String methodName = getNameConstantOperand(); String info = clsName + ":" + methodName; if (expensiveCalls.contains(info)) { bugReporter.reportBug(new BugInstance(this, "SG_SLUGGISH_GUI", NORMAL_PRIORITY) .addClass(this) .addMethod(this) .addSourceLine(this)); methodReported = true; } } } } |
From: Dave B. <dbr...@us...> - 2006-02-02 06:18:11
|
Update of /cvsroot/fb-contrib/fb-contrib/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12608/etc Modified Files: findbugs.xml messages.xml Log Message: new SG - initial checkin Index: messages.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/etc/messages.xml,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- messages.xml 25 Jan 2006 03:26:18 -0000 1.51 +++ messages.xml 2 Feb 2006 06:18:02 -0000 1.52 @@ -418,6 +418,19 @@ </Details> </Detector> + <Detector class="com.mebigfatguy.fbcontrib.detect.SluggishGui"> + <Details> + <![CDATA[ + <p>Looks for methods that implement awt or swing listeners and perform time + consuming operations. Doing these operations in the gui thread will cause the + interface to appear sluggish and non-responsive to the user. It is better to + use a separate thread to do the time consuming work so that the user + has a better experience.</p> + <p>It is a fast Detector</p> + ]]> + </Details> + </Detector> + <!-- BugPattern --> <BugPattern type="ISB_INEFFICIENT_STRING_BUFFERING"> @@ -822,6 +835,25 @@ </Details> </BugPattern> + <BugPattern type="SG_SLUGGISH_GUI"> + <ShortDescription>method performs time consuming operation in gui thread</ShortDescription> + <LongDescription>method {1} performs time consuming operation in gui thread</LongDescription> + <Details> + <![CDATA[ + <p>This method implements an awt or swing listener and performs time + consuming operations. Doing these operations in the gui thread will cause the + interface to appear sluggish and non-responsive to the user. Consider + using a separate thread to do the time consuming work so that the user + has a better experience.</p> + ]]> + </Details> + </BugPattern> + + Looks for methods that implement awt or swing listeners and perform time + consuming operations. Doing these operations in the gui thread will cause the + interface to appear sluggish and non-responsive to the user. It is better to + use a separate thread to do the time consuming work so that the user + has a better experience. <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -856,4 +888,5 @@ <BugCode abbrev="CLI">Constant List Index</BugCode> <BugCode abbrev="SCR">Sloppy Class Reflection</BugCode> <BugCode abbrev="AWCBR">Array Wrapped Call By Reference</BugCode> + <BugCode abbrev="SG">Sluggish Gui</BugCode> </MessageCollection> \ No newline at end of file Index: findbugs.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/etc/findbugs.xml,v retrieving revision 1.57 retrieving revision 1.58 diff -u -d -r1.57 -r1.58 --- findbugs.xml 23 Jan 2006 07:53:06 -0000 1.57 +++ findbugs.xml 2 Feb 2006 06:18:02 -0000 1.58 @@ -142,6 +142,10 @@ speed="fast" reports="AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.SluggishGui" + speed="fast" + reports="SG_SLUGGISH_GUI" /> + <!-- BugPattern --> <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" /> @@ -176,4 +180,5 @@ <BugPattern abbrev="CLI" type="CLI_CONSTANT_LIST_INDEX" category="CORRECTNESS" experimental="true" /> <BugPattern abbrev="SCR" type="SCR_SLOPPY_CLASS_REFLECTION" category="STYLE" experimental="true" /> <BugPattern abbrev="AWCBR" type="AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE" category="STYLE" experimental="true" /> + <BugPattern abbrev="SG" type="SG_SLUGGISH_GUI" category="PERFORMANCE" experimental="true" /> </FindbugsPlugin> \ No newline at end of file |
From: Dave B. <dbr...@us...> - 2006-02-02 06:18:11
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12608/htdocs Modified Files: index.html Log Message: new SG - initial checkin Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.57 retrieving revision 1.58 diff -u -d -r1.57 -r1.58 --- index.html 25 Jan 2006 03:31:26 -0000 1.57 +++ index.html 2 Feb 2006 06:18:02 -0000 1.58 @@ -50,6 +50,12 @@ Note: fb-contrib v2.2.0 requires FindBugs™ v0.95 or later<br/> <div id="cvs" style="display:block;"> <ul> + <li><b>Sluggish Gui</b><br/> + Looks for methods that implement awt or swing listeners and perform time + consuming operations. Doing these operations in the gui thread will cause the + interface to appear sluggish and non-responsive to the user. It is better to + use a separate thread to do the time consuming work so that the user + has a better experience.</li> <li><b>Bloated Synchronized Block</b><br/> Looks for methods that implement synchronized blocks that appear to contain some code at the beginning that does not need to be synchronized. Moving these lines out of the synchronized |
From: Dave B. <dbr...@us...> - 2006-02-02 06:18:11
|
Update of /cvsroot/fb-contrib/fb-contrib/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12608/samples Added Files: SG_Sample.java Log Message: new SG - initial checkin --- NEW FILE: SG_Sample.java --- import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.FileReader; public class SG_Sample implements ActionListener { public void actionPerformed(ActionEvent ae) { FileReader fr = null; try { fr = new FileReader("c:/a.out"); } catch (Exception e) {} finally { try { fr.close(); } catch (Exception ee) {} } } } |
From: Dave B. <dbr...@us...> - 2006-02-01 06:47:57
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16894/src/com/mebigfatguy/fbcontrib/detect Modified Files: BloatedSynchronizedBlock.java Log Message: unsafe aliases aren't just items that are return values of this calls, but also of methods returned from methods calls on other unsafe aliases Index: BloatedSynchronizedBlock.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- BloatedSynchronizedBlock.java 31 Jan 2006 02:14:26 -0000 1.14 +++ BloatedSynchronizedBlock.java 1 Feb 2006 06:47:47 -0000 1.15 @@ -42,7 +42,7 @@ private int syncPC; private boolean isStatic; private int minSafeCodeLength; - private boolean thisCallOccurred; + private boolean unsafeCallOccurred; /** * constructs a BSB detector given the reporter to report bugs on @@ -76,8 +76,9 @@ syncPC = -1; isStatic = obj.isStatic(); unsafeAliases.clear(); + unsafeAliases.add(new Integer(0)); branchInfo.clear(); - thisCallOccurred = false; + unsafeCallOccurred = false; stack.resetForMethodEntry(this); } @@ -91,7 +92,7 @@ try { stack.mergeJumps(this); - if (thisCallOccurred && ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3)))) { + if (unsafeCallOccurred && ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3)))) { int storeReg = astoreReg(seen); if (storeReg >= 0) unsafeAliases.add(new Integer(storeReg)); @@ -106,22 +107,22 @@ int parmCount = Type.getArgumentTypes(methodSig).length; if (stack.getStackDepth() > parmCount) { OpcodeStack.Item itm = stack.getStackItem(parmCount); - thisCallOccurred = (itm.getRegisterNumber() == 0); + unsafeCallOccurred = unsafeAliases.contains(itm.getRegisterNumber()); } else - thisCallOccurred = false; + unsafeCallOccurred = false; } else - thisCallOccurred = false; + unsafeCallOccurred = false; } else if (seen == INVOKESTATIC) - thisCallOccurred = (getDottedClassConstantOperand().equals(this.getClassContext().getJavaClass().getClassName())); + unsafeCallOccurred = (getDottedClassConstantOperand().equals(this.getClassContext().getJavaClass().getClassName())); else if ((seen >= IFEQ) && (seen <= GOTO)) { Integer from = new Integer(getPC()); Integer to = new Integer(getBranchTarget()); branchInfo.put(from, to); - thisCallOccurred = false; + unsafeCallOccurred = false; } else - thisCallOccurred = false; + unsafeCallOccurred = false; if (seen == MONITORENTER) { if (syncPC < 0) { @@ -139,7 +140,7 @@ syncPC = -1; else if (syncPC >= 0) { //TODO: probably static calls are unsafe only if the monitor is on a static - boolean unsafe = thisCallOccurred; + boolean unsafe = unsafeCallOccurred; unsafe |= ((seen == PUTFIELD) || (seen == GETFIELD) || (seen == GETSTATIC) || (seen == PUTSTATIC)); unsafe |= (!isStatic) && ((seen == ALOAD_0) || (seen == ASTORE_0)); int aloadReg = aloadReg(seen); |
From: Dave B. <dbr...@us...> - 2006-02-01 06:47:57
|
Update of /cvsroot/fb-contrib/fb-contrib/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16894/samples Modified Files: BSB_Sample.java Log Message: unsafe aliases aren't just items that are return values of this calls, but also of methods returned from methods calls on other unsafe aliases Index: BSB_Sample.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/samples/BSB_Sample.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- BSB_Sample.java 29 Jan 2006 19:53:05 -0000 1.5 +++ BSB_Sample.java 1 Feb 2006 06:47:47 -0000 1.6 @@ -1,11 +1,16 @@ +import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; import java.util.Set; public class BSB_Sample { private Object lock = new Object(); private Set<String> info = new HashSet<String>(); - + private Map<String, Object> synchMap = Collections.synchronizedMap(new HashMap<String, Object>()); + public void testFieldBeginBloated(int i, int j) { synchronized(lock) @@ -60,4 +65,15 @@ { return info; } + + public void accessSyncMap() { + Set keySet = synchMap.keySet(); + synchronized (synchMap) { + for (Iterator it = keySet.iterator(); it.hasNext();) { + String key = (String) it.next(); + Object obj = synchMap.get(key); + } + } + } + } |
From: Dave B. <dbr...@us...> - 2006-01-31 02:14:38
|
Update of /cvsroot/fb-contrib/fb-contrib/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14252/lib Modified Files: findbugs.jar Log Message: use OpcodeStack.mergeJumps Index: findbugs.jar =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/lib/findbugs.jar,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 Binary files /tmp/cvsfXZzkC and /tmp/cvsCs1VnJ differ |
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14252/src/com/mebigfatguy/fbcontrib/detect Modified Files: ArrayBasedCollections.java ArrayWrappedCallByReference.java BloatedSynchronizedBlock.java ClassEnvy.java CustomBuiltXML.java DubiousListCollection.java InefficientStringBuffering.java ListIndexedIterating.java LiteralStringComparison.java OrphanedDOMNode.java OverlyConcreteParameter.java ParallelLists.java PartiallyConstructedObjectAccess.java SpuriousThreadStates.java StaticMethodInstanceInvocation.java SyncCollectionIterators.java UnrelatedCollectionContents.java Log Message: use OpcodeStack.mergeJumps Index: DubiousListCollection.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/DubiousListCollection.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- DubiousListCollection.java 4 Jan 2006 02:40:42 -0000 1.10 +++ DubiousListCollection.java 31 Jan 2006 02:14:26 -0000 1.11 @@ -115,6 +115,8 @@ @Override public void sawOpcode(final int seen) { try { + stack.mergeJumps(this); + if (seen == INVOKEINTERFACE) { String className = this.getClassConstantOperand(); String methodName = getNameConstantOperand(); Index: BloatedSynchronizedBlock.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- BloatedSynchronizedBlock.java 29 Jan 2006 19:53:05 -0000 1.13 +++ BloatedSynchronizedBlock.java 31 Jan 2006 02:14:26 -0000 1.14 @@ -89,6 +89,8 @@ */ public void sawOpcode(int seen) { try { + stack.mergeJumps(this); + if (thisCallOccurred && ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3)))) { int storeReg = astoreReg(seen); if (storeReg >= 0) Index: ArrayBasedCollections.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayBasedCollections.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ArrayBasedCollections.java 4 Jan 2006 02:40:42 -0000 1.4 +++ ArrayBasedCollections.java 31 Jan 2006 02:14:26 -0000 1.5 @@ -109,6 +109,8 @@ @Override public void sawOpcode(int seen) { try { + stack.mergeJumps(this); + if (seen == INVOKEINTERFACE) { String className = getClassConstantOperand(); String methodName = getNameConstantOperand(); Index: ListIndexedIterating.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ListIndexedIterating.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- ListIndexedIterating.java 4 Jan 2006 02:40:42 -0000 1.11 +++ ListIndexedIterating.java 31 Jan 2006 02:14:26 -0000 1.12 @@ -113,6 +113,8 @@ */ private void sawOpcodeLoop(final int seen) { try { + stack.mergeJumps(this); + switch (state) { case SEEN_NOTHING: if ((seen == IINC) && (getIntConstant() == 1)) { @@ -151,6 +153,8 @@ */ private void sawOpcodeBug(final int seen) { try { + stack.mergeJumps(this); + Iterator<ForLoop> it = possibleForLoops.iterator(); while (it.hasNext()) { ForLoop fl = it.next(); Index: UnrelatedCollectionContents.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/UnrelatedCollectionContents.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- UnrelatedCollectionContents.java 4 Jan 2006 02:40:42 -0000 1.11 +++ UnrelatedCollectionContents.java 31 Jan 2006 02:14:26 -0000 1.12 @@ -95,6 +95,8 @@ @Override public void sawOpcode(final int seen) { try { + stack.mergeJumps(this); + Set<Integer> regs = localScopeEnds.remove(getPC()); if (regs != null) { for (Integer i : regs) { Index: SyncCollectionIterators.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SyncCollectionIterators.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- SyncCollectionIterators.java 4 Jan 2006 02:40:42 -0000 1.10 +++ SyncCollectionIterators.java 31 Jan 2006 02:14:26 -0000 1.11 @@ -102,6 +102,8 @@ @Override public void sawOpcode(final int seen) { try { + stack.mergeJumps(this); + switch (state) { case SEEN_NOTHING: if ((seen == INVOKESTATIC) && "java/util/Collections".equals(getClassConstantOperand())) { Index: CustomBuiltXML.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/CustomBuiltXML.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- CustomBuiltXML.java 20 Jan 2006 04:24:04 -0000 1.6 +++ CustomBuiltXML.java 31 Jan 2006 02:14:26 -0000 1.7 @@ -114,6 +114,8 @@ String strCon = null; try { + stack.mergeJumps(this); + if (seen == INVOKESPECIAL) { String clsName = getClassConstantOperand(); if ("java/lang/StringBuffer".equals(clsName) || "java/lang/StringBuilder".equals(clsName)) { Index: ClassEnvy.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ClassEnvy.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- ClassEnvy.java 4 Jan 2006 02:40:42 -0000 1.18 +++ ClassEnvy.java 31 Jan 2006 02:14:26 -0000 1.19 @@ -173,6 +173,8 @@ @Override public void sawOpcode(final int seen) { try { + stack.mergeJumps(this); + if ((seen == INVOKEVIRTUAL) || (seen == INVOKEINTERFACE) || (seen == INVOKESTATIC) Index: StaticMethodInstanceInvocation.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/StaticMethodInstanceInvocation.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- StaticMethodInstanceInvocation.java 4 Jan 2006 02:40:42 -0000 1.5 +++ StaticMethodInstanceInvocation.java 31 Jan 2006 02:14:26 -0000 1.6 @@ -65,6 +65,8 @@ @Override public void sawOpcode(int seen) { try { + stack.mergeJumps(this); + int sDepth = stack.getStackDepth(); Iterator<PopInfo> it = popStack.iterator(); Index: ArrayWrappedCallByReference.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ArrayWrappedCallByReference.java 25 Jan 2006 03:26:18 -0000 1.3 +++ ArrayWrappedCallByReference.java 31 Jan 2006 02:14:26 -0000 1.4 @@ -91,6 +91,8 @@ public void sawOpcode(int seen) { Integer userValue = null; try { + stack.mergeJumps(this); + if ((seen == NEWARRAY) || (seen == ANEWARRAY)) { if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); Index: ParallelLists.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ParallelLists.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ParallelLists.java 4 Jan 2006 02:40:42 -0000 1.8 +++ ParallelLists.java 31 Jan 2006 02:14:26 -0000 1.9 @@ -91,6 +91,8 @@ @Override public void sawOpcode(final int seen) { try { + stack.mergeJumps(this); + if (seen == INVOKEINTERFACE) { String className = getClassConstantOperand(); String methodName = getNameConstantOperand(); Index: LiteralStringComparison.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/LiteralStringComparison.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- LiteralStringComparison.java 4 Jan 2006 02:40:42 -0000 1.7 +++ LiteralStringComparison.java 31 Jan 2006 02:14:26 -0000 1.8 @@ -68,6 +68,8 @@ @Override public void sawOpcode(final int seen) { try { + stack.mergeJumps(this); + if ((seen == INVOKEVIRTUAL) && "java/lang/String".equals(getClassConstantOperand())) { String calledMethodName = getNameConstantOperand(); String calledMethodSig = getSigConstantOperand(); Index: OrphanedDOMNode.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OrphanedDOMNode.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- OrphanedDOMNode.java 4 Jan 2006 02:40:42 -0000 1.4 +++ OrphanedDOMNode.java 31 Jan 2006 02:14:26 -0000 1.5 @@ -115,6 +115,8 @@ Integer itemPC = null; try { + stack.mergeJumps(this); + if (seen == INVOKEINTERFACE) { String className = getClassConstantOperand(); String methodInfo = getNameConstantOperand() + ":" + getSigConstantOperand(); Index: PartiallyConstructedObjectAccess.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/PartiallyConstructedObjectAccess.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- PartiallyConstructedObjectAccess.java 4 Jan 2006 02:40:42 -0000 1.5 +++ PartiallyConstructedObjectAccess.java 31 Jan 2006 02:14:26 -0000 1.6 @@ -76,6 +76,8 @@ return; try { + stack.mergeJumps(this); + if ((seen == INVOKEVIRTUAL) || (seen == INVOKEINTERFACE)) { int parmCount = Type.getArgumentTypes(getSigConstantOperand()).length; if (stack.getStackDepth() > parmCount) { Index: SpuriousThreadStates.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SpuriousThreadStates.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- SpuriousThreadStates.java 14 Jan 2006 03:19:39 -0000 1.6 +++ SpuriousThreadStates.java 31 Jan 2006 02:14:26 -0000 1.7 @@ -58,6 +58,8 @@ OpcodeStack.Item itm = null; try { + stack.mergeJumps(this); + if (seen == INVOKEVIRTUAL) { String className = getClassConstantOperand(); if ("java/lang/Object".equals(className)) { Index: InefficientStringBuffering.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/InefficientStringBuffering.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- InefficientStringBuffering.java 4 Jan 2006 02:40:42 -0000 1.7 +++ InefficientStringBuffering.java 31 Jan 2006 02:14:26 -0000 1.8 @@ -62,6 +62,8 @@ @Override public void sawOpcode(final int seen) { try { + opStack.mergeJumps(this); + if (seen == INVOKESPECIAL) { String calledClass = getClassConstantOperand(); if (("java/lang/StringBuffer".equals(calledClass) Index: OverlyConcreteParameter.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/OverlyConcreteParameter.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- OverlyConcreteParameter.java 4 Jan 2006 02:40:42 -0000 1.26 +++ OverlyConcreteParameter.java 31 Jan 2006 02:14:26 -0000 1.27 @@ -151,6 +151,8 @@ return; try { + stack.mergeJumps(this); + if ((seen == INVOKEVIRTUAL) || (seen == INVOKESTATIC) || (seen == INVOKESPECIAL) || (seen == INVOKEINTERFACE)) { String methodSig = getSigConstantOperand(); Type[] parmTypes = Type.getArgumentTypes(methodSig); |
From: Dave B. <dbr...@us...> - 2006-01-29 19:53:17
|
Update of /cvsroot/fb-contrib/fb-contrib/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27318/samples Modified Files: BSB_Sample.java Log Message: test cutting down based on branches Index: BSB_Sample.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/samples/BSB_Sample.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- BSB_Sample.java 2 Jan 2006 16:44:01 -0000 1.4 +++ BSB_Sample.java 29 Jan 2006 19:53:05 -0000 1.5 @@ -41,6 +41,21 @@ } } + public void testBranchCutDown(int j) + { + Set<String> i = getInfo(); + synchronized(i) + { + StringBuffer sb = new StringBuffer(); + if (sb.length() > 0) + { + sb.append("Test"); + sb.append(j); + i.add(sb.toString()); + } + } + } + public Set<String> getInfo() { return info; |
From: Dave B. <dbr...@us...> - 2006-01-29 19:53:17
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27318/src/com/mebigfatguy/fbcontrib/detect Modified Files: BloatedSynchronizedBlock.java Log Message: test cutting down based on branches Index: BloatedSynchronizedBlock.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- BloatedSynchronizedBlock.java 29 Jan 2006 19:47:53 -0000 1.12 +++ BloatedSynchronizedBlock.java 29 Jan 2006 19:53:05 -0000 1.13 @@ -51,7 +51,7 @@ */ public BloatedSynchronizedBlock(BugReporter bugReporter) { this.bugReporter = bugReporter; - minSafeCodeLength = Integer.getInteger(BSB_MIN_SAFE_CODE_SIZE, 15).intValue(); + minSafeCodeLength = Integer.getInteger(BSB_MIN_SAFE_CODE_SIZE, 16).intValue(); } /** |
From: Dave B. <dbr...@us...> - 2006-01-29 19:48:02
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25648/src/com/mebigfatguy/fbcontrib/detect Modified Files: BloatedSynchronizedBlock.java Log Message: report the proper line range when the bloated area is truncated via a branch Index: BloatedSynchronizedBlock.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- BloatedSynchronizedBlock.java 27 Jan 2006 04:30:49 -0000 1.11 +++ BloatedSynchronizedBlock.java 29 Jan 2006 19:47:53 -0000 1.12 @@ -40,7 +40,6 @@ private Set<Integer> unsafeAliases = new HashSet<Integer>(); private Map<Integer, Integer> branchInfo = new HashMap<Integer, Integer>(); private int syncPC; - private int lastPC; private boolean isStatic; private int minSafeCodeLength; private boolean thisCallOccurred; @@ -75,7 +74,6 @@ syncPC = 0; else syncPC = -1; - lastPC = -1; isStatic = obj.isStatic(); unsafeAliases.clear(); branchInfo.clear(); @@ -154,7 +152,7 @@ if ((bStart >= syncPC) && (bStart <= pc)) { int bEnd = entry.getValue().intValue(); if (bEnd > pc) { - pc = bStart; + pc = bStart - 1; } } } @@ -162,13 +160,12 @@ bugReporter.reportBug(new BugInstance(this, "BSB_BLOATED_SYNCHRONIZED_BLOCK", NORMAL_PRIORITY) .addClass(this) .addMethod(this) - .addSourceLineRange(this, syncPC + 1, lastPC)); + .addSourceLineRange(this, syncPC + 1, pc)); } } syncPC = -1; } } - lastPC = getPC(); } finally { stack.sawOpcode(this, seen); } |
From: Dave B. <dbr...@us...> - 2006-01-27 04:30:58
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29594/src/com/mebigfatguy/fbcontrib/detect Modified Files: BloatedSynchronizedBlock.java Log Message: if a branch occurs inside the safe section of a BSB, then make sure the entire branch is inside, otherwise clip off the safe section at the start of the branch. Index: BloatedSynchronizedBlock.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/BloatedSynchronizedBlock.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- BloatedSynchronizedBlock.java 16 Jan 2006 01:10:19 -0000 1.10 +++ BloatedSynchronizedBlock.java 27 Jan 2006 04:30:49 -0000 1.11 @@ -18,7 +18,9 @@ */ package com.mebigfatguy.fbcontrib.detect; +import java.util.HashMap; import java.util.HashSet; +import java.util.Map; import java.util.Set; import org.apache.bcel.classfile.Method; @@ -36,6 +38,7 @@ private static final String BSB_MIN_SAFE_CODE_SIZE = "fb-contrib.bsb.minsize"; private OpcodeStack stack = new OpcodeStack(); private Set<Integer> unsafeAliases = new HashSet<Integer>(); + private Map<Integer, Integer> branchInfo = new HashMap<Integer, Integer>(); private int syncPC; private int lastPC; private boolean isStatic; @@ -75,6 +78,7 @@ lastPC = -1; isStatic = obj.isStatic(); unsafeAliases.clear(); + branchInfo.clear(); thisCallOccurred = false; stack.resetForMethodEntry(this); } @@ -109,6 +113,13 @@ thisCallOccurred = false; } else if (seen == INVOKESTATIC) thisCallOccurred = (getDottedClassConstantOperand().equals(this.getClassContext().getJavaClass().getClassName())); + else if ((seen >= IFEQ) && (seen <= GOTO)) + { + Integer from = new Integer(getPC()); + Integer to = new Integer(getBranchTarget()); + branchInfo.put(from, to); + thisCallOccurred = false; + } else thisCallOccurred = false; @@ -134,11 +145,25 @@ int aloadReg = aloadReg(seen); unsafe |= (aloadReg >= 0) && unsafeAliases.contains(new Integer(aloadReg)); if (unsafe) { - if ((getPC() - syncPC) > minSafeCodeLength) { - bugReporter.reportBug(new BugInstance(this, "BSB_BLOATED_SYNCHRONIZED_BLOCK", NORMAL_PRIORITY) - .addClass(this) - .addMethod(this) - .addSourceLineRange(this, syncPC + 1, lastPC)); + //If a branch exists in the safe code, make sure the entire branch + //is in the safe code, otherwise trim before the branch + int pc = getPC(); + if ((pc - syncPC) > minSafeCodeLength) { + for (Map.Entry<Integer, Integer> entry : branchInfo.entrySet()) { + int bStart = entry.getKey().intValue(); + if ((bStart >= syncPC) && (bStart <= pc)) { + int bEnd = entry.getValue().intValue(); + if (bEnd > pc) { + pc = bStart; + } + } + } + if ((pc - syncPC) > minSafeCodeLength) { + bugReporter.reportBug(new BugInstance(this, "BSB_BLOATED_SYNCHRONIZED_BLOCK", NORMAL_PRIORITY) + .addClass(this) + .addMethod(this) + .addSourceLineRange(this, syncPC + 1, lastPC)); + } } syncPC = -1; } |
From: Dave B. <dbr...@us...> - 2006-01-25 03:31:39
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31483/htdocs Modified Files: index.html Log Message: doc that v2.0.0 will need Findbugs v0.95 Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -r1.56 -r1.57 --- index.html 25 Jan 2006 03:28:21 -0000 1.56 +++ index.html 25 Jan 2006 03:31:26 -0000 1.57 @@ -47,6 +47,7 @@ <img id="cvs_image" src="flip2.gif" onClick="toggleBlock('cvs', 'cvs_image');" align="top"/> Detectors added in CVS<br/> Note: these detectors are still in testing<br/> + Note: fb-contrib v2.2.0 requires FindBugs™ v0.95 or later<br/> <div id="cvs" style="display:block;"> <ul> <li><b>Bloated Synchronized Block</b><br/> |
From: Dave B. <dbr...@us...> - 2006-01-25 03:28:29
|
Update of /cvsroot/fb-contrib/fb-contrib/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30601/htdocs Modified Files: index.html Log Message: doc AWCBR Index: index.html =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/htdocs/index.html,v retrieving revision 1.55 retrieving revision 1.56 diff -u -d -r1.55 -r1.56 --- index.html 20 Jan 2006 07:01:46 -0000 1.55 +++ index.html 25 Jan 2006 03:28:21 -0000 1.56 @@ -64,6 +64,10 @@ XXX.class, and doing so protects the integrity of this code from such transformations as obfuscation. Use of Class.forName should only be used when the class in question isn't already statically bound to this context.</li> + <li><b>Array Wrapped Call By Reference</b><br/> + Looks for methods that use an array of length one to pass a variable to achieve call + by pointer ala C++. It is better to define a proper return class type that holds all + the relevant information retrieved from the called method.</li> </ul> </div> |
From: Dave B. <dbr...@us...> - 2006-01-25 03:26:28
|
Update of /cvsroot/fb-contrib/fb-contrib/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30070/etc Modified Files: messages.xml Log Message: make sure the wrapper is passed as an arg to a method Index: messages.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/etc/messages.xml,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- messages.xml 23 Jan 2006 07:54:47 -0000 1.50 +++ messages.xml 25 Jan 2006 03:26:18 -0000 1.51 @@ -811,8 +811,8 @@ </BugPattern> <BugPattern type="AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE"> - <ShortDescription>method uses 1 element array to similate call by reference</ShortDescription> - <LongDescription>method {1} uses 1 element array to similate call by reference</LongDescription> + <ShortDescription>method uses 1 element array to simulate call by reference</ShortDescription> + <LongDescription>method {1} uses 1 element array to simulate call by reference</LongDescription> <Details> <![CDATA[ <p>This method uses a one element array to wrap an object that is to be past to a method as an argument |
From: Dave B. <dbr...@us...> - 2006-01-25 03:26:27
|
Update of /cvsroot/fb-contrib/fb-contrib/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30070/samples Modified Files: AWCBR_Sample.java Log Message: make sure the wrapper is passed as an arg to a method Index: AWCBR_Sample.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/samples/AWCBR_Sample.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- AWCBR_Sample.java 23 Jan 2006 07:53:06 -0000 1.1 +++ AWCBR_Sample.java 25 Jan 2006 03:26:18 -0000 1.2 @@ -22,4 +22,12 @@ i = data[0]; return i; } + + public int testNoCall(int i) + { + //while silly don't report this, as there is no arg usage + int[] data = new int[] { i }; + i = data[0]; + return i; + } } |
From: Dave B. <dbr...@us...> - 2006-01-25 03:26:27
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30070/src/com/mebigfatguy/fbcontrib/detect Modified Files: ArrayWrappedCallByReference.java Log Message: make sure the wrapper is passed as an arg to a method Index: ArrayWrappedCallByReference.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ArrayWrappedCallByReference.java 24 Jan 2006 07:18:17 -0000 1.2 +++ ArrayWrappedCallByReference.java 25 Jan 2006 03:26:18 -0000 1.3 @@ -38,15 +38,12 @@ public class ArrayWrappedCallByReference extends BytecodeScanningDetector implements StatelessDetector { static class WrapperInfo { - static final int WAS_STORED = 0; - static final int WAS_ARG = 1; - static final int WAS_LOADED = 2; public int wrappedReg; - public int state; + public boolean wasArg; public WrapperInfo(int reg) { wrappedReg = reg; - state = WAS_STORED; + wasArg = false; } } @@ -155,7 +152,7 @@ int arrayReg = itm.getRegisterNumber(); WrapperInfo wi = wrappers.get(new Integer(arrayReg)); if (wi != null) - wi.state = WrapperInfo.WAS_ARG; + wi.wasArg = true; } } } @@ -164,7 +161,7 @@ OpcodeStack.Item arItm = stack.getStackItem(1); int arReg = arItm.getRegisterNumber(); WrapperInfo wi = wrappers.get(new Integer(arReg)); - if (wi != null) { + if ((wi != null) && wi.wasArg) { userValue = wi.wrappedReg; } } |
From: Dave B. <dbr...@us...> - 2006-01-24 07:18:25
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17857/src/com/mebigfatguy/fbcontrib/detect Modified Files: ArrayWrappedCallByReference.java Log Message: guard against arrayindexoutofbounds excpetions Index: ArrayWrappedCallByReference.java =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/ArrayWrappedCallByReference.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ArrayWrappedCallByReference.java 23 Jan 2006 07:53:06 -0000 1.1 +++ ArrayWrappedCallByReference.java 24 Jan 2006 07:18:17 -0000 1.2 @@ -121,7 +121,8 @@ } else if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { if (stack.getStackDepth() >= 1) { OpcodeStack.Item itm = stack.getStackItem(0); - if (itm.getSignature().charAt(0) == '[') { + String sig = itm.getSignature(); + if ((sig.length() > 0) && (itm.getSignature().charAt(0) == '[')) { int reg = getAStoreReg(seen); Integer elReg = (Integer)itm.getUserValue(); if (elReg != null) @@ -148,7 +149,8 @@ if (stack.getStackDepth() >= args.length) { for (int i = 0; i < args.length; i++) { Type t = args[i]; - if (t.getSignature().charAt(0) == '[') { + String argSig = t.getSignature(); + if ((argSig.length() > 0) && (argSig.charAt(0) == '[')) { OpcodeStack.Item itm = stack.getStackItem(args.length - i - 1); int arrayReg = itm.getRegisterNumber(); WrapperInfo wi = wrappers.get(new Integer(arrayReg)); |
From: Dave B. <dbr...@us...> - 2006-01-23 07:54:56
|
Update of /cvsroot/fb-contrib/fb-contrib/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10370/etc Modified Files: messages.xml Log Message: better message Index: messages.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/etc/messages.xml,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -r1.49 -r1.50 --- messages.xml 23 Jan 2006 07:53:06 -0000 1.49 +++ messages.xml 23 Jan 2006 07:54:47 -0000 1.50 @@ -815,7 +815,9 @@ <LongDescription>method {1} uses 1 element array to similate call by reference</LongDescription> <Details> <![CDATA[ - <p></p> + <p>This method uses a one element array to wrap an object that is to be past to a method as an argument + to simulate call by pointer ala C++. It is better to define a proper return class type that holds all + the relevant information retrieved from the called method.</p> ]]> </Details> </BugPattern> |
From: Dave B. <dbr...@us...> - 2006-01-23 07:53:15
|
Update of /cvsroot/fb-contrib/fb-contrib/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9694/etc Modified Files: findbugs.xml messages.xml Log Message: initial checkin new AWCBR detector - semi working (requires findbugs.jar 0.95) Index: messages.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/etc/messages.xml,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- messages.xml 21 Jan 2006 07:00:52 -0000 1.48 +++ messages.xml 23 Jan 2006 07:53:06 -0000 1.49 @@ -407,6 +407,17 @@ </Details> </Detector> + <Detector class="com.mebigfatguy.fbcontrib.detect.ArrayWrappedCallByReference"> + <Details> + <![CDATA[ + <p>Looks for methods that use an array of length one to pass a variable to achieve call + by pointer ala C++. It is better to define a proper return class type that holds all + the relevant information retrieved from the called method.</p> + <p>It is a fast Detector</p> + ]]> + </Details> + </Detector> + <!-- BugPattern --> <BugPattern type="ISB_INEFFICIENT_STRING_BUFFERING"> @@ -799,6 +810,16 @@ </Details> </BugPattern> + <BugPattern type="AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE"> + <ShortDescription>method uses 1 element array to similate call by reference</ShortDescription> + <LongDescription>method {1} uses 1 element array to similate call by reference</LongDescription> + <Details> + <![CDATA[ + <p></p> + ]]> + </Details> + </BugPattern> + <!-- BugCode --> <BugCode abbrev="ISB">Inefficient String Buffering</BugCode> @@ -832,4 +853,5 @@ <BugCode abbrev="BSB">Bloated Synchronized Block</BugCode> <BugCode abbrev="CLI">Constant List Index</BugCode> <BugCode abbrev="SCR">Sloppy Class Reflection</BugCode> + <BugCode abbrev="AWCBR">Array Wrapped Call By Reference</BugCode> </MessageCollection> \ No newline at end of file Index: findbugs.xml =================================================================== RCS file: /cvsroot/fb-contrib/fb-contrib/etc/findbugs.xml,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -r1.56 -r1.57 --- findbugs.xml 21 Jan 2006 07:00:52 -0000 1.56 +++ findbugs.xml 23 Jan 2006 07:53:06 -0000 1.57 @@ -138,6 +138,10 @@ speed="fast" reports="SCR_SLOPPY_CLASS_REFLECTION" /> + <Detector class="com.mebigfatguy.fbcontrib.detect.ArrayWrappedCallByReference" + speed="fast" + reports="AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE" /> + <!-- BugPattern --> <BugPattern abbrev="ISB" type="ISB_INEFFICIENT_STRING_BUFFERING" category="PERFORMANCE" /> @@ -171,4 +175,5 @@ <BugPattern abbrev="BSB" type="BSB_BLOATED_SYNCHRONIZED_BLOCK" category="PERFORMANCE" experimental="true" /> <BugPattern abbrev="CLI" type="CLI_CONSTANT_LIST_INDEX" category="CORRECTNESS" experimental="true" /> <BugPattern abbrev="SCR" type="SCR_SLOPPY_CLASS_REFLECTION" category="STYLE" experimental="true" /> + <BugPattern abbrev="AWCBR" type="AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE" category="STYLE" experimental="true" /> </FindbugsPlugin> \ No newline at end of file |
From: Dave B. <dbr...@us...> - 2006-01-23 07:53:14
|
Update of /cvsroot/fb-contrib/fb-contrib/src/com/mebigfatguy/fbcontrib/detect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9694/src/com/mebigfatguy/fbcontrib/detect Added Files: ArrayWrappedCallByReference.java Log Message: initial checkin new AWCBR detector - semi working (requires findbugs.jar 0.95) --- NEW FILE: ArrayWrappedCallByReference.java --- /* * fb-contrib - Auxilliary detectors for Java programs * Copyright (C) 2005-2006 Dave Brosius * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package com.mebigfatguy.fbcontrib.detect; import java.util.HashMap; import java.util.Map; import org.apache.bcel.classfile.Code; import org.apache.bcel.generic.Type; import edu.umd.cs.findbugs.BugInstance; import edu.umd.cs.findbugs.BugReporter; import edu.umd.cs.findbugs.BytecodeScanningDetector; import edu.umd.cs.findbugs.OpcodeStack; import edu.umd.cs.findbugs.StatelessDetector; /** * Looks for methods that use an array of length one to pass a variable to achieve call * by pointer ala C++. It is better to define a proper return class type that holds all * the relevant information retrieved from the called method. */ public class ArrayWrappedCallByReference extends BytecodeScanningDetector implements StatelessDetector { static class WrapperInfo { static final int WAS_STORED = 0; static final int WAS_ARG = 1; static final int WAS_LOADED = 2; public int wrappedReg; public int state; public WrapperInfo(int reg) { wrappedReg = reg; state = WAS_STORED; } } private BugReporter bugReporter; private OpcodeStack stack = new OpcodeStack(); private Map<Integer, WrapperInfo> wrappers = new HashMap<Integer, WrapperInfo>(); /** * constructs a AWCBR detector given the reporter to report bugs on * @param bugReporter the sync of bug reports */ public ArrayWrappedCallByReference(BugReporter bugReporter) { this.bugReporter = bugReporter; } /** * clone this detector so that it can be a StatelessDetector * * @return a clone of this object */ @Override public Object clone() throws CloneNotSupportedException { return super.clone(); } /** * implements the visitor to reset the stack of opcodes * * @param obj the context object for the currently parsed code block */ @Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); wrappers.clear(); super.visitCode(obj); } /** * implements the visitor to wrapped array parameter calls * * @param seen the currently visitor opcode */ @Override public void sawOpcode(int seen) { Integer userValue = null; try { if ((seen == NEWARRAY) || (seen == ANEWARRAY)) { if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); Integer size = (Integer)itm.getConstant(); if ((size != null) && (size.intValue() == 1)) { userValue = new Integer(-1); } } } else if ((seen >= IASTORE) && (seen <= SASTORE)) { if (stack.getStackDepth() >= 2) { OpcodeStack.Item itm = stack.getStackItem(2); int reg = itm.getRegisterNumber(); if (reg != -1) { WrapperInfo wi = wrappers.get(new Integer(reg)); if (wi != null) { OpcodeStack.Item elItm = stack.getStackItem(0); wi.wrappedReg = elItm.getRegisterNumber(); } } else { OpcodeStack.Item elItm = stack.getStackItem(0); if (elItm.getRegisterNumber() != -1) userValue = new Integer(elItm.getRegisterNumber()); } } } else if ((seen == ASTORE) || ((seen >= ASTORE_0) && (seen <= ASTORE_3))) { if (stack.getStackDepth() >= 1) { OpcodeStack.Item itm = stack.getStackItem(0); if (itm.getSignature().charAt(0) == '[') { int reg = getAStoreReg(seen); Integer elReg = (Integer)itm.getUserValue(); if (elReg != null) wrappers.put(new Integer(reg), new WrapperInfo(elReg)); } else { Integer elReg = (Integer)itm.getUserValue(); if (elReg != null) { int reg = getAStoreReg(seen); if (elReg.intValue() == reg) { bugReporter.reportBug(new BugInstance(this, "AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE", NORMAL_PRIORITY ) .addClass(this) .addMethod(this) .addSourceLine(this)); } } } } } else if ((seen == INVOKEVIRTUAL) || (seen == INVOKEINTERFACE) || (seen == INVOKESPECIAL) || (seen == INVOKESTATIC)) { String sig = getSigConstantOperand(); Type[] args = Type.getArgumentTypes(sig); if (stack.getStackDepth() >= args.length) { for (int i = 0; i < args.length; i++) { Type t = args[i]; if (t.getSignature().charAt(0) == '[') { OpcodeStack.Item itm = stack.getStackItem(args.length - i - 1); int arrayReg = itm.getRegisterNumber(); WrapperInfo wi = wrappers.get(new Integer(arrayReg)); if (wi != null) wi.state = WrapperInfo.WAS_ARG; } } } } else if ((seen >= IALOAD) && (seen <= SALOAD)) { if (stack.getStackDepth() >= 2) { OpcodeStack.Item arItm = stack.getStackItem(1); int arReg = arItm.getRegisterNumber(); WrapperInfo wi = wrappers.get(new Integer(arReg)); if (wi != null) { userValue = wi.wrappedReg; } } } else if ((seen == ALOAD) || ((seen >= ALOAD_0) && (seen <= ALOAD_3))) { int reg = getALoadReg(seen); WrapperInfo wi = wrappers.get(new Integer(reg)); if (wi != null) userValue = new Integer(wi.wrappedReg); } else if (((seen == ISTORE) || ((seen >= ISTORE_0) && (seen <= ISTORE_3))) || ((seen == LSTORE) || ((seen >= LSTORE_0) && (seen <= LSTORE_3))) || ((seen == DSTORE) || ((seen >= DSTORE_0) && (seen <= DSTORE_3))) || ((seen == FSTORE) || ((seen >= FSTORE_0) && (seen <= FSTORE_3)))) { if (stack.getStackDepth() >= 1) { OpcodeStack.Item itm = stack.getStackItem(0); Integer elReg = (Integer)itm.getUserValue(); if (elReg != null) { int reg = getStoreReg(seen); if (elReg.intValue() == reg) { bugReporter.reportBug(new BugInstance(this, "AWCBR_ARRAY_WRAPPED_CALL_BY_REFERENCE", NORMAL_PRIORITY ) .addClass(this) .addMethod(this) .addSourceLine(this)); } } } } } finally { stack.sawOpcode(this, seen); if (userValue != null) { if (stack.getStackDepth() > 0) { OpcodeStack.Item itm = stack.getStackItem(0); itm.setUserValue(userValue); } } } } private int getAStoreReg(int seen) { if (seen == ASTORE) return getRegisterOperand(); return seen - ASTORE_0; } private int getALoadReg(int seen) { if (seen == ALOAD) return getRegisterOperand(); return seen - ALOAD_0; } private int getStoreReg(int seen) { if ((seen == ASTORE) || (seen == ISTORE) || (seen == LSTORE) || (seen == FSTORE) || (seen == DSTORE)) return getRegisterOperand(); if (seen <= ISTORE_3) return seen - ISTORE_0; else if (seen <= LSTORE_3) return seen - LSTORE_0; else if (seen <= FSTORE_3) return seen - FSTORE_0; else if (seen <= DSTORE_3) return seen - DSTORE_0; return seen - ASTORE_0; } } |