Bug 118192 - Missing superclass for java.io.Serializable in reflection 1.5 delegate impl
Summary: Missing superclass for java.io.Serializable in reflection 1.5 delegate impl
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.5.0RC1   Edit
Assignee: Andrew Clement CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-28 02:07 EST by Ron Bodkin CLA
Modified: 2012-04-03 15:47 EDT (History)
0 users

See Also:


Attachments
adds a failing test case to TestJava5ReflectionBasedReferenceTypeDelegate (1.10 KB, patch)
2005-11-28 02:10 EST, Ron Bodkin CLA
no flags Details | Diff
Put tests for null superclass into base reflection delegate test not just the 1.5 tests (1.73 KB, patch)
2005-11-28 02:33 EST, Ron Bodkin CLA
aclement: iplog+
Details | Diff
fixes the problem: checks for any class with a null superclass, even an interface (908 bytes, patch)
2005-11-28 02:35 EST, Ron Bodkin CLA
aclement: iplog+
Details | Diff
Fixes pre-1.5 reflection delegate to be consistent by returning Object as the superclass of an interface. (967 bytes, patch)
2005-11-28 12:12 EST, Ron Bodkin CLA
aclement: iplog+
Details | Diff
Patch to remove the 1.5-specific test from the weaver project (1.66 KB, patch)
2005-11-28 12:14 EST, Ron Bodkin CLA
aclement: iplog+
Details | Diff
Patch to add the 1.5-specific test to the weaver5 project test case instead (1.53 KB, patch)
2005-11-28 12:16 EST, Ron Bodkin CLA
aclement: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ron Bodkin CLA 2005-11-28 02:07:52 EST
See attached patch for a failing junit test case.
Comment 1 Ron Bodkin CLA 2005-11-28 02:10:43 EST
Created attachment 30689 [details]
adds a failing test case to TestJava5ReflectionBasedReferenceTypeDelegate
Comment 2 Ron Bodkin CLA 2005-11-28 02:16:14 EST
This test fails on the Java 1.5 reflection delegate impl, since it returns a missing type (which is clearly wrong). 

If you move this test to the Java reflection delegate impl, it throws an NPE, since that implementation has the superclass of java.io.Serializable as null. The javadoc comment in ResolvedType.getSuperclass doesn't specify what the superclass of a top-level interface should be. 

If null is the right superclass here, then the test should just assertNull :-)


Comment 3 Ron Bodkin CLA 2005-11-28 02:33:55 EST
Created attachment 30691 [details]
Put tests for null superclass into base reflection delegate test not just the 1.5 tests

Adds more tests and moves tests to base test case. Supersedes previous test case.
Comment 4 Ron Bodkin CLA 2005-11-28 02:35:46 EST
Created attachment 30692 [details]
fixes the problem: checks for any class with a null superclass, even an interface
Comment 5 Ron Bodkin CLA 2005-11-28 02:45:21 EST
It looks like the superclass behavior is inconsistent between Java's notion of the superclass and BCEL's. This test fails:

	public void testGenericInterfaceSuperclass() {
		BcelWorld world = new BcelWorld();
		world.setBehaveInJava5Way(true);
		UnresolvedType javaUtilMap = UnresolvedType.forName("java.util.Map");
		ResolvedType rtx = world.resolve(javaUtilMap);
		assertNull(rtx.getSuperclass());		
	}

The rtx.getSuperclass() result is Object...

I discovered this because my patch caused an NPE in ReferenceType.getSuperclass() ...
Comment 6 Andrew Clement CLA 2005-11-28 10:55:26 EST
The reflection based stuff is intended to be a drop in replacement for the bcel stuff.  Therefore we need the reflection stuff to return the same as bcel.  So, I've modified the reflection code to return a superclass of Object rather than NULL - except for primitive types where it is null (bcel returns null in these cases too).  I modified Rons supplied test programs to verify consistency across the bcel world and reflection world.

fixes checked in.
Comment 7 Ron Bodkin CLA 2005-11-28 12:12:21 EST
Created attachment 30714 [details]
Fixes pre-1.5 reflection delegate to be consistent by returning Object as the superclass of an interface.

This works for the 1.5 implementation but the pre-1.5 code was still breaking. This updated patch fixes the pre-1.5 implementation
Comment 8 Ron Bodkin CLA 2005-11-28 12:14:23 EST
Created attachment 30715 [details]
Patch to remove the 1.5-specific test from the weaver project

This test relies on Java 5 and was breaking on the earlier Java versions.
Comment 9 Ron Bodkin CLA 2005-11-28 12:16:40 EST
Created attachment 30716 [details]
Patch to add the 1.5-specific test to the weaver5 project test case instead

These 3 patches fix the pre-1.5 reflection implementation and move tests around to work properly for both pre-1.5 and 1.5.
Comment 10 Andrew Clement CLA 2005-11-28 12:43:54 EST
oops, silly me - hurrying and I've made mistakes.  I've applied those changes.  Can you possibly create patches at the module level rather than the file level Ron?  They are much easier for me to work with.
Comment 11 Andrew Clement CLA 2005-11-29 05:18:30 EST
fix available.