[Fb-contrib-commit] SF.net SVN: fb-contrib:[1457] trunk/fb-contrib
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2010-01-10 16:52:03
|
Revision: 1457
http://fb-contrib.svn.sourceforge.net/fb-contrib/?rev=1457&view=rev
Author: dbrosius
Date: 2010-01-10 16:51:57 +0000 (Sun, 10 Jan 2010)
Log Message:
-----------
rename WrongNullGuard to SuspiciousNullGuard
Modified Paths:
--------------
trunk/fb-contrib/etc/findbugs.xml
trunk/fb-contrib/etc/messages.xml
Added Paths:
-----------
trunk/fb-contrib/samples/SNG_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousNullGuard.java
Removed Paths:
-------------
trunk/fb-contrib/samples/WNG_Sample.java
trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java
Modified: trunk/fb-contrib/etc/findbugs.xml
===================================================================
--- trunk/fb-contrib/etc/findbugs.xml 2010-01-10 02:14:08 UTC (rev 1456)
+++ trunk/fb-contrib/etc/findbugs.xml 2010-01-10 16:51:57 UTC (rev 1457)
@@ -313,8 +313,8 @@
<Detector class="com.mebigfatguy.fbcontrib.detect.NonFunctionalField"
speed="fast" reports="NFF_NON_FUNCTIONAL_FIELD" />
- <Detector class="com.mebigfatguy.fbcontrib.detect.WrongNullGuard"
- speed="fast" hidden="true" reports="WNG_WRONG_NULL_FIELD_GUARD,WNG_WRONG_NULL_LOCAL_GUARD" />
+ <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousNullGuard"
+ speed="fast" reports="SNG_WRONG_NULL_FIELD_GUARD,SNG_WRONG_NULL_LOCAL_GUARD" />
<Detector class="com.mebigfatguy.fbcontrib.detect.MoreDumbMethods"
speed="fast"
@@ -570,9 +570,9 @@
category="CORRECTNESS" experimental="true" />
<BugPattern abbrev="NFF" type="NFF_NON_FUNCTIONAL_FIELD"
category="CORRECTNESS" experimental="true" />
- <BugPattern abbrev="WNG" type="WNG_WRONG_NULL_FIELD_GUARD"
+ <BugPattern abbrev="SNG" type="SNG_WRONG_NULL_FIELD_GUARD"
category="CORRECTNESS" experimental="true" />
- <BugPattern abbrev="WNG" type="WNG_WRONG_NULL_LOCAL_GUARD"
+ <BugPattern abbrev="SNG" type="SNG_WRONG_NULL_LOCAL_GUARD"
category="CORRECTNESS" experimental="true" />
<BugPattern abbrev="MDM" type="MDM_RUNTIME_EXIT_OR_HALT"
category="CORRECTNESS" experimental="true" />
Modified: trunk/fb-contrib/etc/messages.xml
===================================================================
--- trunk/fb-contrib/etc/messages.xml 2010-01-10 02:14:08 UTC (rev 1456)
+++ trunk/fb-contrib/etc/messages.xml 2010-01-10 16:51:57 UTC (rev 1457)
@@ -1078,7 +1078,7 @@
</Details>
</Detector>
- <Detector class="com.mebigfatguy.fbcontrib.detect.WrongNullGuard">
+ <Detector class="com.mebigfatguy.fbcontrib.detect.SuspiciousNullGuard">
<Details>
<![CDATA[
<p>looks for code that checks to see if a field or local variable is not null,
@@ -2822,7 +2822,7 @@
</Details>
</BugPattern>
- <BugPattern type="WNG_WRONG_NULL_FIELD_GUARD">
+ <BugPattern type="SNG_WRONG_NULL_FIELD_GUARD">
<ShortDescription>method tests a field for null as guard for code that doesn't use it</ShortDescription>
<LongDescription>method {1} tests a field for null as guard for code that doesn't use it</LongDescription>
<Details>
@@ -2835,7 +2835,7 @@
</Details>
</BugPattern>
- <BugPattern type="WNG_WRONG_NULL_LOCAL_GUARD">
+ <BugPattern type="SNG_WRONG_NULL_LOCAL_GUARD">
<ShortDescription>method tests a local variable for null as guard for code that doesn't use it</ShortDescription>
<LongDescription>method {1} tests a local variable for null as guard for code that doesn't use it</LongDescription>
<Details>
@@ -3087,6 +3087,6 @@
<BugCode abbrev="NSE">Non Symmetric Equals</BugCode>
<BugCode abbrev="CVAA">Contravariant Array Assignment</BugCode>
<BugCode abbrev="NFF">Non Functional Field</BugCode>
- <BugCode abbrev="WNG">Wrong Null Guard</BugCode>
+ <BugCode abbrev="SNG">Wrong Null Guard</BugCode>
<BugCode abbrev="MDM">More Dumb Methods</BugCode>
</MessageCollection>
Copied: trunk/fb-contrib/samples/SNG_Sample.java (from rev 1453, trunk/fb-contrib/samples/WNG_Sample.java)
===================================================================
--- trunk/fb-contrib/samples/SNG_Sample.java (rev 0)
+++ trunk/fb-contrib/samples/SNG_Sample.java 2010-01-10 16:51:57 UTC (rev 1457)
@@ -0,0 +1,73 @@
+import java.io.File;
+
+
+public class SNG_Sample
+{
+ private static byte[] EMPTY_BYTE_ARRAY = new byte[0];
+ private Object f1 = null;
+ private Object f2 = null;
+ private File file = null;
+ private byte[] buffer = null;
+
+ public String badSNGFields()
+ {
+ if (f1 != null)
+ return f2.toString();
+
+ return null;
+ }
+
+ public String badSNGLocals(Object l1, Object l2)
+ {
+ if (l1 != null)
+ return l2.toString();
+
+ return null;
+ }
+
+ public boolean fpReturn(Object o) {
+ return o != null;
+ }
+
+ public boolean fpAssign(Object o) {
+ boolean b = o != null;
+ return b;
+ }
+
+ public boolean fpField() {
+ if (f1 != null)
+ return true;
+
+ return false;
+ }
+
+ public void fpAssert() {
+ assert f1 != null && f1.equals(f2);
+ }
+
+ public Object fpSetNull(Object o) {
+ if (o != null)
+ o = null;
+
+ return o;
+ }
+
+ public void fpSetMemberNull() {
+ if (f1 != null)
+ f1 = null;
+ }
+
+ public void fpDual(Object o1, Object o2) {
+ if (o1 == null || o2 == null) {
+ throw new IllegalArgumentException("o1/o2 can not be null");
+ }
+ }
+
+ public void discard() {
+ if (file != null) {
+ file.delete();
+ } else if (buffer != null) {
+ buffer = EMPTY_BYTE_ARRAY;
+ }
+ }
+}
Deleted: trunk/fb-contrib/samples/WNG_Sample.java
===================================================================
--- trunk/fb-contrib/samples/WNG_Sample.java 2010-01-10 02:14:08 UTC (rev 1456)
+++ trunk/fb-contrib/samples/WNG_Sample.java 2010-01-10 16:51:57 UTC (rev 1457)
@@ -1,73 +0,0 @@
-import java.io.File;
-
-
-public class WNG_Sample
-{
- private static byte[] EMPTY_BYTE_ARRAY = new byte[0];
- private Object f1 = null;
- private Object f2 = null;
- private File file = null;
- private byte[] buffer = null;
-
- public String badWNGFields()
- {
- if (f1 != null)
- return f2.toString();
-
- return null;
- }
-
- public String badWNGLocals(Object l1, Object l2)
- {
- if (l1 != null)
- return l2.toString();
-
- return null;
- }
-
- public boolean fpReturn(Object o) {
- return o != null;
- }
-
- public boolean fpAssign(Object o) {
- boolean b = o != null;
- return b;
- }
-
- public boolean fpField() {
- if (f1 != null)
- return true;
-
- return false;
- }
-
- public void fpAssert() {
- assert f1 != null && f1.equals(f2);
- }
-
- public Object fpSetNull(Object o) {
- if (o != null)
- o = null;
-
- return o;
- }
-
- public void fpSetMemberNull() {
- if (f1 != null)
- f1 = null;
- }
-
- public void fpDual(Object o1, Object o2) {
- if (o1 == null || o2 == null) {
- throw new IllegalArgumentException("o1/o2 can not be null");
- }
- }
-
- public void discard() {
- if (file != null) {
- file.delete();
- } else if (buffer != null) {
- buffer = EMPTY_BYTE_ARRAY;
- }
- }
-}
Copied: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousNullGuard.java (from rev 1451, trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java)
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousNullGuard.java (rev 0)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/SuspiciousNullGuard.java 2010-01-10 16:51:57 UTC (rev 1457)
@@ -0,0 +1,279 @@
+/*
+ * fb-contrib - Auxiliary detectors for Java programs
+ * Copyright (C) 2005-2010 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.Iterator;
+import java.util.Map;
+
+import org.apache.bcel.classfile.Code;
+import org.apache.bcel.classfile.LocalVariable;
+import org.apache.bcel.classfile.LocalVariableTable;
+
+import com.mebigfatguy.fbcontrib.utils.RegisterUtils;
+
+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.ba.ClassContext;
+import edu.umd.cs.findbugs.ba.XField;
+
+/**
+ * looks for code that checks to see if a field or local variable is not null,
+ * before entering a code block either an if, or while statement, and then doesn't
+ * reference that field or local in the block of code that is guarded by the null
+ * check. It is likely that null check is being done on the wrong variable, either
+ * because of a copy/paste error, or a change in implementation.
+ */
+public class SuspiciousNullGuard extends BytecodeScanningDetector {
+
+ private BugReporter bugReporter;
+ private OpcodeStack stack;
+ private LocalVariableTable lvt;
+ private Map<Integer, NullGuard> nullGuards;
+
+ /**
+ * constructs a SNG detector given the reporter to report bugs on
+ * @param bugReporter the sync of bug reports
+ */
+ public SuspiciousNullGuard(BugReporter bugReporter) {
+ this.bugReporter = bugReporter;
+ }
+
+ /**
+ * overrides the visitor to initialize and tear down the opcode stack
+ *
+ * @param classContext the context object of the currently parsed class
+ */
+ @Override
+ public void visitClassContext(ClassContext classContext) {
+ try {
+ stack = new OpcodeStack();
+ nullGuards = new HashMap<Integer, NullGuard>();
+ super.visitClassContext(classContext);
+ } finally {
+ stack = null;
+ }
+ }
+
+ /**
+ * overrides the visitor to reset the stack
+ *
+ * @param obj the context object of the currently parsed code block
+ */
+ @Override
+ public void visitCode(Code obj) {
+ try {
+ stack.resetForMethodEntry(this);
+ lvt = getMethod().getLocalVariableTable();
+ nullGuards.clear();
+ super.visitCode(obj);
+ } finally {
+ lvt = null;
+ }
+ }
+
+ /**
+ * overrides the visitor to look for bad null guards
+ *
+ * @param seen the opcode of the currently visited instruction
+ */
+ @Override
+ public void sawOpcode(int seen) {
+ try {
+ Integer pc = Integer.valueOf(getPC());
+ NullGuard guard = nullGuards.remove(pc);
+ if ((guard != null) && guard.sawSignatureOfGuard()) {
+ boolean localBug = guard.getRegister() >= 0;
+ bugReporter.reportBug(new BugInstance(this, localBug ? "SNG_WRONG_NULL_LOCAL_GUARD" : "SNG_WRONG_NULL_FIELD_GUARD", localBug ? NORMAL_PRIORITY : LOW_PRIORITY)
+ .addClass(this)
+ .addMethod(this)
+ .addSourceLine(this, guard.getLocation()));
+ }
+
+ switch (seen) {
+ case IFNULL: {
+ if (stack.getStackDepth() > 0) {
+ OpcodeStack.Item item = stack.getStackItem(0);
+ int reg = item.getRegisterNumber();
+ Integer target = Integer.valueOf(getBranchTarget());
+ if (reg >= 0) {
+ nullGuards.put(target, new NullGuard(reg, pc.intValue(), item.getSignature()));
+ } else {
+ XField xf = item.getXField();
+ if (xf != null) {
+ nullGuards.put(target, new NullGuard(xf, pc.intValue(), item.getSignature()));
+ }
+ }
+ }
+ }
+ break;
+
+ case ALOAD:
+ case ALOAD_0:
+ case ALOAD_1:
+ case ALOAD_2:
+ case ALOAD_3: {
+ if (lvt != null) {
+ LocalVariable lv = lvt.getLocalVariable(RegisterUtils.getALoadReg(this, seen), getNextPC());
+ if (lv != null) {
+ markNullGuards(lv.getSignature());
+ }
+ }
+ }
+ break;
+
+ case ASTORE:
+ case ASTORE_0:
+ case ASTORE_1:
+ case ASTORE_2:
+ case ASTORE_3: {
+ removeGuardForRegister(RegisterUtils.getAStoreReg(this, seen));
+ }
+ break;
+
+ case GETFIELD: {
+ markNullGuards(getSigConstantOperand());
+ }
+ break;
+
+ case PUTFIELD: {
+ removeGuardForField(getXField());
+ }
+ break;
+
+ case INVOKEVIRTUAL:
+ case INVOKEINTERFACE: {
+ if (nullGuards.size() > 0) {
+ String clsName = getClassConstantOperand();
+ String methodName = getNameConstantOperand();
+ if ("java/io/PrintStream".equals(clsName) && methodName.startsWith("print")) {
+ nullGuards.clear();
+ }
+ }
+ }
+ break;
+
+ case IFNONNULL:
+ case ATHROW: {
+ nullGuards.clear();
+ }
+ break;
+
+ case GOTO: {
+ if (stack.getStackDepth() > 0) {
+ nullGuards.clear();
+ }
+ }
+ break;
+ }
+ } finally {
+ stack.sawOpcode(this, seen);
+ if (stack.getStackDepth() > 0) {
+ OpcodeStack.Item item = stack.getStackItem(0);
+ int reg = item.getRegisterNumber();
+ if (reg >= 0) {
+ removeGuardForRegister(reg);
+ } else {
+ XField field = item.getXField();
+ if (field != null)
+ removeGuardForField(field);
+ }
+ }
+ }
+ }
+
+ private void markNullGuards(String signature) {
+ for (NullGuard ng : nullGuards.values()) {
+ if (ng.getSignature().equals(signature)) {
+ ng.markSignatureOfGuard();
+ }
+ }
+ }
+
+ private void removeGuardForRegister(int reg) {
+ Iterator<NullGuard> it = nullGuards.values().iterator();
+ while (it.hasNext()) {
+ NullGuard guard = it.next();
+ if (reg == guard.getRegister()) {
+ it.remove();
+ }
+ }
+ }
+
+ private void removeGuardForField(XField field) {
+ Iterator<NullGuard> it = nullGuards.values().iterator();
+ while (it.hasNext()) {
+ NullGuard guard = it.next();
+ if (field != null) {
+ if (field.equals(guard.getField())) {
+ it.remove();
+ }
+ }
+ }
+ }
+
+ static class NullGuard {
+ int register;
+ XField field;
+ int location;
+ String signature;
+ boolean sawSignature = false;
+
+ public NullGuard(int reg, int start, String guardSignature) {
+ register = reg;
+ field = null;
+ location = start;
+ signature = guardSignature;
+ }
+
+
+ public NullGuard(XField xf, int start, String guardSignature) {
+ register = -1;
+ field = xf;
+ location = start;
+ signature = guardSignature;
+ }
+
+ public int getRegister() {
+ return register;
+ }
+
+ public XField getField() {
+ return field;
+ }
+
+ public int getLocation() {
+ return location;
+ }
+
+ public String getSignature() {
+ return signature;
+ }
+
+ public void markSignatureOfGuard() {
+ sawSignature = true;
+ }
+
+ public boolean sawSignatureOfGuard() {
+ return sawSignature;
+ }
+ }
+}
Deleted: trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java
===================================================================
--- trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java 2010-01-10 02:14:08 UTC (rev 1456)
+++ trunk/fb-contrib/src/com/mebigfatguy/fbcontrib/detect/WrongNullGuard.java 2010-01-10 16:51:57 UTC (rev 1457)
@@ -1,279 +0,0 @@
-/*
- * fb-contrib - Auxiliary detectors for Java programs
- * Copyright (C) 2005-2010 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.Iterator;
-import java.util.Map;
-
-import org.apache.bcel.classfile.Code;
-import org.apache.bcel.classfile.LocalVariable;
-import org.apache.bcel.classfile.LocalVariableTable;
-
-import com.mebigfatguy.fbcontrib.utils.RegisterUtils;
-
-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.ba.ClassContext;
-import edu.umd.cs.findbugs.ba.XField;
-
-/**
- * looks for code that checks to see if a field or local variable is not null,
- * before entering a code block either an if, or while statement, and then doesn't
- * reference that field or local in the block of code that is guarded by the null
- * check. It is likely that null check is being done on the wrong variable, either
- * because of a copy/paste error, or a change in implementation.
- */
-public class WrongNullGuard extends BytecodeScanningDetector {
-
- private BugReporter bugReporter;
- private OpcodeStack stack;
- private LocalVariableTable lvt;
- private Map<Integer, NullGuard> nullGuards;
-
- /**
- * constructs a WNG detector given the reporter to report bugs on
- * @param bugReporter the sync of bug reports
- */
- public WrongNullGuard(BugReporter bugReporter) {
- this.bugReporter = bugReporter;
- }
-
- /**
- * overrides the visitor to initialize and tear down the opcode stack
- *
- * @param classContext the context object of the currently parsed class
- */
- @Override
- public void visitClassContext(ClassContext classContext) {
- try {
- stack = new OpcodeStack();
- nullGuards = new HashMap<Integer, NullGuard>();
- super.visitClassContext(classContext);
- } finally {
- stack = null;
- }
- }
-
- /**
- * overrides the visitor to reset the stack
- *
- * @param obj the context object of the currently parsed code block
- */
- @Override
- public void visitCode(Code obj) {
- try {
- stack.resetForMethodEntry(this);
- lvt = getMethod().getLocalVariableTable();
- nullGuards.clear();
- super.visitCode(obj);
- } finally {
- lvt = null;
- }
- }
-
- /**
- * overrides the visitor to look for bad null guards
- *
- * @param seen the opcode of the currently visited instruction
- */
- @Override
- public void sawOpcode(int seen) {
- try {
- Integer pc = Integer.valueOf(getPC());
- NullGuard guard = nullGuards.remove(pc);
- if ((guard != null) && guard.sawSignatureOfGuard()) {
- boolean localBug = guard.getRegister() >= 0;
- bugReporter.reportBug(new BugInstance(this, localBug ? "WNG_WRONG_NULL_LOCAL_GUARD" : "WNG_WRONG_NULL_FIELD_GUARD", localBug ? NORMAL_PRIORITY : LOW_PRIORITY)
- .addClass(this)
- .addMethod(this)
- .addSourceLine(this, guard.getLocation()));
- }
-
- switch (seen) {
- case IFNULL: {
- if (stack.getStackDepth() > 0) {
- OpcodeStack.Item item = stack.getStackItem(0);
- int reg = item.getRegisterNumber();
- Integer target = Integer.valueOf(getBranchTarget());
- if (reg >= 0) {
- nullGuards.put(target, new NullGuard(reg, pc.intValue(), item.getSignature()));
- } else {
- XField xf = item.getXField();
- if (xf != null) {
- nullGuards.put(target, new NullGuard(xf, pc.intValue(), item.getSignature()));
- }
- }
- }
- }
- break;
-
- case ALOAD:
- case ALOAD_0:
- case ALOAD_1:
- case ALOAD_2:
- case ALOAD_3: {
- if (lvt != null) {
- LocalVariable lv = lvt.getLocalVariable(RegisterUtils.getALoadReg(this, seen), getNextPC());
- if (lv != null) {
- markNullGuards(lv.getSignature());
- }
- }
- }
- break;
-
- case ASTORE:
- case ASTORE_0:
- case ASTORE_1:
- case ASTORE_2:
- case ASTORE_3: {
- removeGuardForRegister(RegisterUtils.getAStoreReg(this, seen));
- }
- break;
-
- case GETFIELD: {
- markNullGuards(getSigConstantOperand());
- }
- break;
-
- case PUTFIELD: {
- removeGuardForField(getXField());
- }
- break;
-
- case INVOKEVIRTUAL:
- case INVOKEINTERFACE: {
- if (nullGuards.size() > 0) {
- String clsName = getClassConstantOperand();
- String methodName = getNameConstantOperand();
- if ("java/io/PrintStream".equals(clsName) && methodName.startsWith("print")) {
- nullGuards.clear();
- }
- }
- }
- break;
-
- case IFNONNULL:
- case ATHROW: {
- nullGuards.clear();
- }
- break;
-
- case GOTO: {
- if (stack.getStackDepth() > 0) {
- nullGuards.clear();
- }
- }
- break;
- }
- } finally {
- stack.sawOpcode(this, seen);
- if (stack.getStackDepth() > 0) {
- OpcodeStack.Item item = stack.getStackItem(0);
- int reg = item.getRegisterNumber();
- if (reg >= 0) {
- removeGuardForRegister(reg);
- } else {
- XField field = item.getXField();
- if (field != null)
- removeGuardForField(field);
- }
- }
- }
- }
-
- private void markNullGuards(String signature) {
- for (NullGuard ng : nullGuards.values()) {
- if (ng.getSignature().equals(signature)) {
- ng.markSignatureOfGuard();
- }
- }
- }
-
- private void removeGuardForRegister(int reg) {
- Iterator<NullGuard> it = nullGuards.values().iterator();
- while (it.hasNext()) {
- NullGuard guard = it.next();
- if (reg == guard.getRegister()) {
- it.remove();
- }
- }
- }
-
- private void removeGuardForField(XField field) {
- Iterator<NullGuard> it = nullGuards.values().iterator();
- while (it.hasNext()) {
- NullGuard guard = it.next();
- if (field != null) {
- if (field.equals(guard.getField())) {
- it.remove();
- }
- }
- }
- }
-
- static class NullGuard {
- int register;
- XField field;
- int location;
- String signature;
- boolean sawSignature = false;
-
- public NullGuard(int reg, int start, String guardSignature) {
- register = reg;
- field = null;
- location = start;
- signature = guardSignature;
- }
-
-
- public NullGuard(XField xf, int start, String guardSignature) {
- register = -1;
- field = xf;
- location = start;
- signature = guardSignature;
- }
-
- public int getRegister() {
- return register;
- }
-
- public XField getField() {
- return field;
- }
-
- public int getLocation() {
- return location;
- }
-
- public String getSignature() {
- return signature;
- }
-
- public void markSignatureOfGuard() {
- sawSignature = true;
- }
-
- public boolean sawSignatureOfGuard() {
- return sawSignature;
- }
- }
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|