Closed dankurka closed 9 years ago
I also get the same exception in GWT 2.1.1.
Reported by willjohnson3
on 2011-03-30 13:05:50
finally got the compiler running in the debugger. This turned out to be a problem with
the code obfuscator when trying to handle the clone() method i added to Object.java
in the emul tree. The obfuscator has a special list of object types to obfuscate of
which Object is one of them (specialObfuscatedTypes). If the method being translated
is in that class it assumes there is an entry in the method names map (specialObfuscatedIdents).
since I added clone() it's not in the list of idents and this returns null which then
gets handed down to the interner.
setting the output type to 'pretty' seems to work around the issue for now. it seems
like a simple 'if (null) return originalName' would fix the issue and allow people
to override Object.java and other types from the special types set. i'll try to get
a patch together shortly.
Reported by willjohnson3
on 2011-03-31 16:43:33
i think the following patch should do the job:
Index: src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
===================================================================
--- src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java (revision 9918)
+++ src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java (working copy)
@@ -2238,7 +2238,10 @@
assert (specialObfuscatedIdents.containsKey(x.getName()));
switch (output) {
case OBFUSCATED:
- return specialObfuscatedIdents.get(x.getName());
+ // make sure we allow end users to add methods to obfuscated types that don't
+ // have entries in the obfuscated idents table. (ie adding clone() to Object.java)
GWT Issue# 6216
+ String tmp = specialObfuscatedIdents.get(x.getName());
+ return tmp == null ? x.getName() : tmp;
case PRETTY:
return x.getName() + "$";
case DETAILED:
Reported by willjohnson3
on 2011-03-31 18:03:05
I'm not sure what the right thing to do is wrt obfuscation but i have verified that
the above patch does fix the obfuscation bug and allows user code to add methods to
Object and other 'known' types without issue.
Reported by willjohnson3
on 2011-04-04 13:48:05
Reported by dankurka@google.com
on 2013-06-02 19:11:01
AssumedStale
Originally reported on Google Code with ID 6212
Reported by
willjohnson3
on 2011-03-30 12:51:04