Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 317381

Summary: [otre] ClassCircularityError in flight bonus example
Product: [Tools] Objectteams Reporter: Stephan Herrmann <stephan.herrmann>
Component: OTJAssignee: Stephan Herrmann <stephan.herrmann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 0.7   
Target Milestone: 0.7   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
proposed fix none

Description Stephan Herrmann CLA 2010-06-20 12:55:19 EDT
When running the flight bonus example in a Java 6 VM, the following
ClassCircularityError is thrown:

Error transforming class: java.util.LinkedHashMap$KeyIterator
java.lang.ClassCircularityError: java/util/LinkedHashMap$KeyIterator
	at java.util.LinkedHashMap.newKeyIterator(LinkedHashMap.java:396)
	at java.util.HashMap$KeySet.iterator(HashMap.java:874)
	at java.io.ExpiringCache.cleanup(ExpiringCache.java:99)
	at java.io.ExpiringCache.get(ExpiringCache.java:56)
	at java.io.UnixFileSystem.canonicalize(UnixFileSystem.java:137)
	at java.io.File.getCanonicalPath(File.java:559)
	at sun.security.provider.PolicyFile.canonPath(PolicyFile.java:1844)
	at java.io.FilePermission$1.run(FilePermission.java:186)
	at java.io.FilePermission$1.run(FilePermission.java:183)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.io.FilePermission.init(FilePermission.java:183)
	at java.io.FilePermission.<init>(FilePermission.java:249)
	at sun.net.www.protocol.file.FileURLConnection.getPermission(FileURLConnection.java:198)
	at sun.net.www.protocol.jar.JarFileFactory.getPermission(JarFileFactory.java:124)
	at sun.net.www.protocol.jar.JarFileFactory.getCachedJarFile(JarFileFactory.java:94)
	at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:50)
	at sun.net.www.protocol.jar.JarURLConnection.connect(JarURLConnection.java:104)
	at sun.net.www.protocol.jar.JarURLConnection.getInputStream(JarURLConnection.java:132)
	at java.net.URL.openStream(URL.java:1010)
	at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:1170)
	at org.apache.bcel.util.ClassPath.getInputStream(ClassPath.java:179)
	at org.apache.bcel.util.ClassPath.getInputStream(ClassPath.java:165)
	at org.apache.bcel.util.SyntheticRepository.loadClass(SyntheticRepository.java:126)
	at org.apache.bcel.Repository.lookupClass(Repository.java:62)
	at org.eclipse.objectteams.otre.RepositoryAccess.instanceOf(RepositoryAccess.java:117)
	at org.eclipse.objectteams.otre.RepositoryAccess.safeSubclassOf(RepositoryAccess.java:101)
	at org.eclipse.objectteams.otre.util.CallinBindingManager.getInheritedCallinBindings(CallinBindingManager.java:413)
 ...

Additionally, running in a Java 5 is currently not possible because the
OTRE jars seem to be compiled with a 1.6 target.
Comment 1 Stephan Herrmann CLA 2010-06-20 12:58:29 EDT
Created attachment 172293 [details]
proposed fix

This patch catches ClassCircularityError in RepositoryAccess.safeSubclassOf()
assuming that circularity was introduced by accessing additional classes
from framework code.

Additionally avoid transforming the specific class that caused the exception.
Comment 2 Stephan Herrmann CLA 2010-06-20 14:04:38 EDT
The patch has been committed as r522, which resolves the exception.

As of build 201006201327 the classfile version issue has been solved, too.
Comment 3 Stephan Herrmann CLA 2010-07-02 13:17:57 EDT
Verified using build 201007011455.