|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
[ checkstyle-Bugs-1671882 ] Checkstyle-Plugin: Throwable occuredBugs item #1671882, was opened at 2007-03-01 18:26
Message generated for change (Comment added) made by hohwille You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397078&aid=1671882&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: None Status: Open Resolution: None Priority: 2 Private: No Submitted By: anb (anbmaconomy) Assigned to: Nobody/Anonymous (nobody) Summary: Checkstyle-Plugin: Throwable occured Initial Comment: It seems like CheckStyle cannot process the following Java interface: public interface TestInterface <E extends Throwable> { public void foo() throws E; } The problems seems to be that CheckStyle cannot process a throws clause that refers to a generic parameter. It creates the following stack trace: java.lang.RuntimeException: Unable to get class information for E. at com.puppycrawl.tools.checkstyle.checks.AbstractTypeAwareCheck.logLoadErrorImpl(AbstractTypeAwareCheck.java:291) at com.puppycrawl.tools.checkstyle.checks.coding.RedundantThrowsCheck.logLoadError(RedundantThrowsCheck.java:121) at com.puppycrawl.tools.checkstyle.checks.AbstractTypeAwareCheck.tryLoadClass(AbstractTypeAwareCheck.java:260) at com.puppycrawl.tools.checkstyle.checks.AbstractTypeAwareCheck$RegularClass.getClazz(AbstractTypeAwareCheck.java:481) at com.puppycrawl.tools.checkstyle.checks.coding.RedundantThrowsCheck.checkException(RedundantThrowsCheck.java:145) at com.puppycrawl.tools.checkstyle.checks.coding.RedundantThrowsCheck.processAST(RedundantThrowsCheck.java:108) at com.puppycrawl.tools.checkstyle.checks.AbstractTypeAwareCheck.visitToken(AbstractTypeAwareCheck.java:146) at com.puppycrawl.tools.checkstyle.TreeWalker.notifyVisit(TreeWalker.java:500) at com.puppycrawl.tools.checkstyle.TreeWalker.processIter(TreeWalker.java:625) at com.puppycrawl.tools.checkstyle.TreeWalker.walk(TreeWalker.java:426) at com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:244) at com.puppycrawl.tools.checkstyle.TreeWalker.process(TreeWalker.java:590) at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:239) at com.atlassw.tools.eclipse.checkstyle.builder.Auditor.runAudit(Auditor.java:193) at com.atlassw.tools.eclipse.checkstyle.builder.CheckstyleBuilder.handleBuildSelection(CheckstyleBuilder.java:341) at com.atlassw.tools.eclipse.checkstyle.builder.CheckstyleBuilder.build(CheckstyleBuilder.java:212) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:603) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:167) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201) at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:230) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:233) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:252) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:285) at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:145) at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:208) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58) ---------------------------------------------------------------------- Comment By: Jörg Hohwiller (hohwille) Date: 2009-09-14 23:15 Message: Instead of the current behavior it would already be an improvement, if you just would ignore generic exceptions. You could figure this out by using getGenericExceptionTypes() instead and if a returned Type is no instance of java.lang.Class you could just ignore it. However causing an exception and therefore producing errors in my IDE is really the worst scenario. ---------------------------------------------------------------------- Comment By: Jörg Hohwiller (hohwille) Date: 2009-07-02 08:59 Message: If you want to deal with generics properly, you might want to consider some library like mmm-util-core. Then you can resolve the proper type of E and load that class instead. https://m-m-m.svn.sourceforge.net/svnroot/m-m-m/trunk/mmm-util/mmm-util-core/src/main/java/net/sf/mmm/util/reflect/api/GenericType.java https://m-m-m.svn.sourceforge.net/svnroot/m-m-m/trunk/mmm-util/mmm-util-core/src/main/java/net/sf/mmm/util/reflect/api/ReflectionUtil.java ---------------------------------------------------------------------- Comment By: Jörg Hohwiller (hohwille) Date: 2009-07-01 11:37 Message: SuppressionCommentFilter also does NOT help as workaround. Checkstyle finds some "throws E" in the code and then tries to load the class "E" which is entire nonsense. This is a bug and should be fixed. ---------------------------------------------------------------------- Comment By: Jörg Hohwiller (hohwille) Date: 2009-07-01 09:44 Message: Even if I remove the RedundantThrows rule and have no such rule left, the error remains. ---------------------------------------------------------------------- Comment By: Jörg Hohwiller (hohwille) Date: 2009-07-01 09:35 Message: > This error can be avoided using RedundantThrows > check's property -> logLoadErrors set to true. This simply does not work! Did you ever test this? There is no problem loading the class! Checkstyle should stop throwing RuntimeExceptions if it things there is something it did not expect. In my eclipse the enitre project gets marked as having errors. The error is checkstyle and not my project. See also https://sourceforge.net/tracker/?func=detail&atid=397078&aid=2791544&group_id=29721 ---------------------------------------------------------------------- Comment By: Oliver Burn (oburn) Date: 2009-06-17 14:14 Message: there is a valid workaround ---------------------------------------------------------------------- Comment By: djarma (djarma) Date: 2007-06-06 15:43 Message: Logged In: YES user_id=1809875 Originator: NO This error can be avoided using RedundantThrows check's property -> logLoadErrors set to true. See http://checkstyle.sourceforge.net/config_coding.html#RedundantThrows for more info... ---------------------------------------------------------------------- Comment By: MiSo (coolmischa) Date: 2007-05-20 16:14 Message: Logged In: YES user_id=1797504 Originator: NO Moin, moin I've got the same problem. I'm working with RSA 7.0.x on Linux and have imported source code from a MS Windows source. The default encoding on the MS Win system is CP1512 or ISO-8859-15, on my linux box the defualt is UTF-8. The first error from Checkstyle reported in all files with IS0-8859-15 special Characters like german Umlauts was: "TreeWalker: Got an exception - null" After adjusting the charset property in my checkstyle configuration german Umlauts were not a problem any more but in any File which has a method with more than one throws clause the error was: "Got an exception - java.lang.RuntimeException: Unable to get class information for @throws tag 'e'" Rebuilding the project removes the errors. Unfortunatley now my RSA 7.0.x close unexpectedly ;-( ---------------------------------------------------------------------- Comment By: DGardner (dgardner_curam) Date: 2007-04-24 13:58 Message: Logged In: YES user_id=1663951 Originator: NO Me too. I've just run into this problem with an interface that takes a parameterized exception type. I get the (legendary) Eclipse plug-in message: "Got an exception - java.lang.RuntimeException: Unable to get class information for @throws tag 'E'." This is the same message I get when Checkstyle (or the plug-in) loses the plot and starts complaining about real exception classes that do exist in the same project, but that is another story. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=397078&aid=1671882&group_id=29721 ------------------------------------------------------------------------------ Come build with us! The BlackBerry® 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/devconf _______________________________________________ Checkstyle-devel mailing list Checkstyle-devel@... https://lists.sourceforge.net/lists/listinfo/checkstyle-devel |
| Free embeddable forum powered by Nabble | Forum Help |