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

Infinite compile time and tons of errors #850

Closed
AntonPanikov opened this issue Mar 21, 2019 · 8 comments
Closed

Infinite compile time and tons of errors #850

AntonPanikov opened this issue Mar 21, 2019 · 8 comments
Assignees
Labels
Milestone

Comments

@AntonPanikov
Copy link

After the recent update my grails project start compile very slowly and usually stuck at 90% and I see a tons of similar error in the logs.

Eclipse:
Version: 2018-09 (4.9.0)
Build id: 20180917-1800

Plugins: 3.3.0.xx-201903191633-e1809

All errors is the same like:

BUG! exception in phase 'canonicalization' in source unit '****Edited*****.groovy' unexpected NullpointerException
	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1148)
	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:630)
	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:608)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:585)
	at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.processToPhase(GroovyCompilationUnitDeclaration.java:222)
	at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyCompilationUnitDeclaration.analyseCode(GroovyCompilationUnitDeclaration.java:700)
	at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:910)
	at org.eclipse.jdt.internal.compiler.ProcessTaskManager.run(ProcessTaskManager.java:145)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
	at org.grails.io.support.MainClassFinder.searchMainClass(MainClassFinder.groovy:38)
	at org.grails.compiler.injection.test.TestMixinTransformation.visit(TestMixinTransformation.java:113)
	at org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:197)
	at org.codehaus.groovy.transform.ASTTransformationVisitor$2.call(ASTTransformationVisitor.java:258)
	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1143)
	... 8 more

And all my groovy files is marked as compile error:

Groovy:Groovy compiler error: exception in phase 'canonicalization' in source unit '***Edited***.groovy' unexpected NullpointerException @ line 1, column 0.
@eric-milles
Copy link
Member

Can you say what is at line 38 of org.grails.io.support.MainClassFinder.searchMainClass?

@AntonPanikov
Copy link
Author

This is the open source here:
https://github.com/grails/grails-core/blob/3.2.x/grails-bootstrap/src/main/groovy/org/grails/io/support/MainClassFinder.groovy

    /**
     * Searches for the main class relative to the give path that is within the project tree
     *
     * @param path The path as a URI
     * @return The name of the main class
     */
    static String searchMainClass(URI path) {

        def pathStr = path.toString()
        if(mainClasses.containsKey(pathStr)) {
            return mainClasses.get(pathStr)
        }

I think the line 38 is:

  def pathStr = path.toString()

@eric-milles
Copy link
Member

Okay, got it. source.getSource().getURI() is returning null. Recent change was made to use a CharArrayReaderSource instead of a StringReaderSource and null was returned for URI instead of building a huge URI like the string reader did.

@eric-milles
Copy link
Member

eric-milles commented Mar 21, 2019

Please note that InputStreamReaderSource always returns null and StringReaderSource sometimes returns null from getURI(). So grails should be hardened against these possibilities.

@AntonPanikov
Copy link
Author

I got that you are saying, but I am not a contributor to grails project and I am not sure how grails is using readers. Could you create an issue for them?

@eric-milles
Copy link
Member

You just need to create an issue for "Add null safety for any use of ReaderSource.getURI()". At least one instance exists between TestMixinTransformation and MainClassFinder.

@eric-milles
Copy link
Member

Ready to test

@AntonPanikov
Copy link
Author

Verified on:
3.3.0.xx-201903212137-e1809

No issue, no errors. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants