Re: Mistake when interface extends interface
Eugene Kuleshov <[email protected]>
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <[email protected]> |
Pierre,
You are quoting the Java language specification, but ASM works at the
bytecode level, which is very loosely coupled with the high-level language.
In short, in the bytecode, the interface can't have a parent class, so
javac is compiling Java's "extends" for interfaces into a list of
intefaces. Also note that you can't have multiple parent classes for a
class, but you can for an interface.
All in all, the ASM framework just literally interprets the bytecode
for you.
regards,
Eugene
Pierre Caserta wrote:
> Hi,
> it seems impossible to know when an interface inherit another
> interface with ASM, because the extends clause is treated like an
> implements clause when parsing an interface.
> This is very problematic because interface that extends other
> interface have a particular semantic:
>
> Chapter 9.1.2 of the java sun docs second edition :
>
>
> 9.1.2 Superinterfaces and Subinterfaces
>
> If an |extends| clause is provided, then the interface being declared
> extends each of the other named interfaces and therefore inherits the
> member types, methods, and constants of each of the other named
> interfaces. These other named interfaces are the /direct
> superinterfaces/ of the interface being declared. Any class that
> |implements| the declared interface is also considered to implement
> all the interfaces that this interface |extends|.
>
> /ExtendsInterfaces:
> / extends /InterfaceType
> ExtendsInterfaces , InterfaceType
>
>
> /
>
> Bellow I give an example and explain the problem.
>
> The javadoc of the visit method of the ClassVisitor says :
> void *visit*(int version,
> int access,
> java.lang.String name,
> java.lang.String signature,
> java.lang.String superName,
> java.lang.String[] interfaces)
> Visits the header of the class.
> *Parameters:*
> |superName| - the internal of name of the super class (see
> |getInternalName|
> <http://asm.ow2.org/jdiff153to223/ASM%202.2.3/org/objectweb/asm/Type.html#getInternalName%28%29>).
> For interfaces, the super class is |Object|. May be null, but only for
> the |Object| class.
> ----------------------
> For instance I take the "java/util/List" Interface that extends the
> "java/util/Collection" interface.
>
> The visit method will have : superName = "java/lang/Object"
> interfaces = {"java/util/Collection"}
> That is wrong!
> It is like if the extends clause is simply replaced by an implements
> clause, which is not the same.
>
> Does someone have a solution to know if an interface is extending (and
> not implementing) another interface with asm?
>
> --
> Pierre Caserta, Ph.D. Candidate | Email: [email protected]
> Nancy-Université INPL / LORIA, | Phone: (+33) (0)3 54 95 86 18
> Office C-123, | Mobile: (+33) (0)6 76 58 29 42
> 615 Rue du Jardin Botanique, CS 20101 | Web: www.loria.fr/~casertap
> 54603 VILLERS-LES-NANCY Cedex, FRANCE |
>
message-footer.txt
(text/plain, 238 B)
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws