Skip to content

Instantly share code, notes, and snippets.

@bonifaido
Created May 24, 2013 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bonifaido/5644680 to your computer and use it in GitHub Desktop.
Save bonifaido/5644680 to your computer and use it in GitHub Desktop.
Fix for javac 9003176: Class reference duplicates in constant pool
diff --git a/src/share/classes/com/sun/tools/javac/jvm/Pool.java b/src/share/classes/com/sun/tools/javac/jvm/Pool.java
--- a/src/share/classes/com/sun/tools/javac/jvm/Pool.java
+++ b/src/share/classes/com/sun/tools/javac/jvm/Pool.java
@@ -28,6 +28,7 @@
import java.util.*;
import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.code.Type.ClassType;
/** An internal structure that corresponds to the constant pool of a classfile.
*
@@ -100,6 +101,10 @@
value = new Method((MethodSymbol)value);
else if (value instanceof VarSymbol)
value = new Variable((VarSymbol)value);
+ else if (value instanceof ClassType) {
+ ClassType ct = (ClassType) value;
+ value = ct.tsym;
+ }
// assert !(value instanceof Type.TypeVar);
Integer index = indices.get(value);
if (index == null) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment