|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
[ checkstyle-Bugs-2777291 ] unable to load class info when inner class in super classBugs item #2777291, was opened at 2009-04-21 09:49
Message generated for change (Comment added) made by mihobson You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397078&aid=2777291&group_id=29721 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: release 5.0 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Conny K. (krappatsch) Assigned to: Nobody/Anonymous (nobody) Summary: unable to load class info when inner class in super class Initial Comment: Hello, I know there have been lots of similar issues and I've read most (if not all) of them. But still something seems to be wrong. We have a class A with an Exception E declared as public static inner class. Then we have a class B derived from class A with a method m throwing E. If we now use @throw tag in the javadoc of m, we get the "unable to load class information" error (in fact we get the german version "Klassen-Information für E nicht verfügbar.") An @throw tag in the javadoc of a similar method in A does not cause any Problems. We use Checkstyle 4.3. I also tried 4.4 and 5.0 - all the same. Example: Class A: public class A { /** * @throws E no problem here */ public synchronized void m1() throws E { throw new E("just a demo"); } public static class E extends Exception { public E(String message) { super(message); } } } Class B: public class B extends A { /** * @throws E THIS CAUSES THE PROBLEM */ public synchronized void m() throws E { throw new E("just a demo"); } } Checkstyle configuration: <?xml version="1.0"?> <!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> <module name="Checker"> <module name="TreeWalker"> <module name="RedundantThrows"/> </module> </module> regards, Conny ---------------------------------------------------------------------- Comment By: Mark Hobson (mihobson) Date: 2009-10-20 16:09 Message: I've experienced this in 5.0 even without subclassing. For example: public interface Foo { public static class FooException extends Exception { } void bar() throws FooException; } With config: <module name="Checker"> <module name="TreeWalker"> <module name="RedundantThrows"/> </module> </module> Produces: "java.lang.RuntimeException: Unable to get class information for FooException." Looks like a regression as this bug has been reported and fixed for earlier versions (1220726), possibly introduced by the fix for 1379666. A quick run through the debugger shows that RedundantThrowsCheck is missing its current class name, so inner classes cannot be resolved. A workaround is to declare the exception using the outer class, e.g.: public interface Foo { public static class FooException extends Exception { } void bar() throws Foo.FooException; } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397078&aid=2777291&group_id=29721 ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Checkstyle-devel mailing list Checkstyle-devel@... https://lists.sourceforge.net/lists/listinfo/checkstyle-devel |
| Free embeddable forum powered by Nabble | Forum Help |