Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error reporting #93

Open
dbachelder opened this issue Mar 17, 2014 · 7 comments
Open

Better error reporting #93

dbachelder opened this issue Mar 17, 2014 · 7 comments
Milestone

Comments

@dbachelder
Copy link
Contributor

Somehow I have a broken build.. here is the stack trace:

There doesn't seem to be an obvious problems in the fragment or its Injected stuff... but this error isn't much to go on. I see in the generated code a reference to import org.androidtransfuse.Transfuse$$ScopesUtil; which doesn't seem to have been generated yet... but other than that, I'm not seeing much... Where in this stack could we output some good context that would quickly help get to the bottom of this?

Caused by: org.androidtransfuse.transaction.TransactionRuntimeException: Encountered ErrorType SillyFragment, unable to recover
    at org.androidtransfuse.adapter.element.ASTTypeBuilderVisitor.visitError(ASTTypeBuilderVisitor.java:65)
    at org.androidtransfuse.adapter.element.ASTTypeBuilderVisitor.visitError(ASTTypeBuilderVisitor.java:34)
    at com.sun.tools.javac.code.Type$ErrorType.accept(Type.java:1345)
    at org.androidtransfuse.adapter.element.ElementASTTypeLazyLoader.buildASTType(ElementASTTypeLazyLoader.java:35)
    at org.androidtransfuse.adapter.element.ASTTypeLazyLoader.getASTType(ASTTypeLazyLoader.java:45)
    at org.androidtransfuse.adapter.element.ASTElementParameter.getASTType(ASTElementParameter.java:43)
    at org.androidtransfuse.analysis.InjectionPointFactory.buildInjectionPoint(InjectionPointFactory.java:84)
    at org.androidtransfuse.analysis.astAnalyzer.InjectionAnalyzer.analyzeType(InjectionAnalyzer.java:55)
    at org.androidtransfuse.analysis.Analyzer.scanClassHierarchy(Analyzer.java:112)
    at org.androidtransfuse.analysis.Analyzer.scanClassHierarchy(Analyzer.java:106)
    at org.androidtransfuse.analysis.Analyzer.analyze(Analyzer.java:85)
    at org.androidtransfuse.analysis.Analyzer.analyze(Analyzer.java:41)
    at org.androidtransfuse.gen.variableBuilder.VariableInjectionNodeBuilder.buildInjectionNode(VariableInjectionNodeBuilder.java:41)
    at org.androidtransfuse.analysis.InjectionPointFactory.buildInjectionNode(InjectionPointFactory.java:174)
    at org.androidtransfuse.analysis.InjectionPointFactory.buildInjectionNode(InjectionPointFactory.java:153)
    at org.androidtransfuse.gen.componentBuilder.InjectionNodeFactoryImpl.buildInjectionNode(InjectionNodeFactoryImpl.java:69)
    at org.androidtransfuse.gen.ComponentGenerator.generate(ComponentGenerator.java:73)
    at org.androidtransfuse.gen.AnalysisGeneration.innerRun(AnalysisGeneration.java:47)
@dbachelder
Copy link
Contributor Author

I did end up fixing this problem... although I'm still not entirely sure what did it since I changed so much. But I think the larger issue still stands.. My biggest problem with transfuse is the lack of meaningful context when there is a problem. Even if you could spit out what was under analysis at the time of failure, that would go a long way to improving productivity at midnight on a sunday :)

@johncarl81
Copy link
Owner

Really good idea Dan. We could also add a line specific error report for this case (ErrorType encountered).

@johncarl81
Copy link
Owner

Here's my thoughts on how to attempt to make this better:

  1. Add component error logging, something on the order of: generating component x failed
  2. Whenever an exception is thrown be sure to also use the error reporter (Validator) to file a line specific error (especially the TransactionRuntimeException).
  3. Hide the stack trace under a command line flag. I think these are more distracting than helpful.

Thoughts?

@dbachelder
Copy link
Contributor Author

maybe do what grade does and hide it by default and add "add --showstack to see stacktrace" to the error message.

@johncarl81
Copy link
Owner

yes, that's what I had in mind.

@dbachelder
Copy link
Contributor Author

Here's another example... the only way I know how to track this down is to add a bunch of system.outs to transfuse and use a local version of it... is there a smarter way?

Exception in thread "pool-209-thread-1" org.androidtransfuse.TransfuseAdapterException: Encountered unknown TypeMirror, unable to recover
    at org.androidtransfuse.adapter.element.ASTTypeBuilderVisitor.visitUnknown(ASTTypeBuilderVisitor.java:105)
    at org.androidtransfuse.adapter.element.ASTTypeBuilderVisitor.visitUnknown(ASTTypeBuilderVisitor.java:34)
    at javax.lang.model.util.AbstractTypeVisitor6.visitIntersection(AbstractTypeVisitor6.java:133)
    at com.sun.tools.javac.code.Type$IntersectionClassType.accept(Type.java:1004)
    at org.androidtransfuse.adapter.element.ASTTypeBuilderVisitor.visitTypeVariable(ASTTypeBuilderVisitor.java:70)
    at org.androidtransfuse.adapter.element.ASTTypeBuilderVisitor.visitTypeVariable(ASTTypeBuilderVisitor.java:34)
    at com.sun.tools.javac.code.Type$TypeVar.accept(Type.java:1304)
    at org.androidtransfuse.adapter.element.ElementASTTypeLazyLoader.buildASTType(ElementASTTypeLazyLoader.java:35)
    at org.androidtransfuse.adapter.element.ASTTypeLazyLoader.getASTType(ASTTypeLazyLoader.java:45)
    at org.androidtransfuse.adapter.element.ASTElementParameter.getASTType(ASTElementParameter.java:43)
    at org.androidtransfuse.adapter.MethodSignature.makeDescriptor(MethodSignature.java:49)
    at org.androidtransfuse.adapter.MethodSignature.<init>(MethodSignature.java:32)
    at org.androidtransfuse.analysis.Analyzer.isOverridden(Analyzer.java:146)
    at org.androidtransfuse.analysis.Analyzer.scanClassHierarchy(Analyzer.java:115)
    at org.androidtransfuse.analysis.Analyzer.scanClassHierarchy(Analyzer.java:106)
    at org.androidtransfuse.analysis.Analyzer.analyze(Analyzer.java:85)
    at org.androidtransfuse.analysis.Analyzer.analyze(Analyzer.java:41)
    at org.androidtransfuse.gen.variableBuilder.FragmentViewInjectionNodeBuilder.buildInjectionNode(FragmentViewInjectionNodeBuilder.java:57)

@johncarl81
Copy link
Owner

I think you have a good idea around at least logging the component being analyzed/generated. Other than that I think better error reporting through the javax.annotation.processing.Messager is called for. I've been thinking a lot about the core of Transfuse lately and some redesign may be in store around these ideas. I'd appreciate some collaboration on this, if you have the time.

@johncarl81 johncarl81 added this to the 0.3.0 Release milestone Aug 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants