• Bug
  • Status: Open
  • 3 Minor
  • Resolution:
  • DSO:L1
  • interfaces
  • Reporter: teck
  • March 14, 2007
  • 0
  • Watchers: 0
  • December 16, 2011

Description

abstract class A extends HashSet; class B extends A

If B is included for instrumentation, you’ll be rewarded with a java.lang.InstantiationError

Some actual sample code that produces the issue:

private static abstract class AbstractSub extends HashSet { public abstract String abstractMethod(); }

private static class SubclassOfAbstractLogicalSubclass extends AbstractSub { final String s = “sdkfj”;

public String abstractMethod() {
  return s;
}   \}

Comments

Tim Eck 2007-03-14

Best I can tell from the instrumentation, we’re trying to new up an instance of the abstract super class to use as the delegate

Saravanan Subbiah 2007-03-15

I am wondering why we instrument B to delegate calls ? If we have a delegate in A and make sure every public and protected methods are delegated to it, B should work like any other physical object that extends another class, no ?

Antonio Si 2007-03-15

I think the problem here is that A, which is a direct subclass of HashSet, has no field. So, the instrumentation treat it as a regular logical class. B, which is a subclass of A, has a field in it. So, the instrumentation tries to create a delegate field of type A, and it fails because A is an abstract class.