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

With eclispe groovy plugin 3.x we can't compile our project anymore #737

Closed
wagnerma opened this issue Oct 1, 2018 · 9 comments
Closed
Assignees
Labels
Milestone

Comments

@wagnerma
Copy link

wagnerma commented Oct 1, 2018

We try to switch our project to the Eclipse-Groovy 3.x plugin. But the project now has errors ;-(. There seems some strange problems perhaps in the area CompileStatic in combination with Java, no clue. The code is correct, it runs and compile fine with the old Eclipse-Groovy plugin.

The groovy code is CompileStatic and uses a java class of the type:

public class OpCaldocitemtypeType extends OptionObject {
    private static final long serialVersionUID = -1462780516731381671L;

	// STL-Position/Komponente
	public static final Integer BOM_ITEM = 10;
	// Arbeitsgang
	public static final Integer ROU_OPR = 20;
	// Variable
	public static final Integer VAR_ENTRY = 30;
	// Referenz auf anderes Schema
	public static final Integer CAL_DOCREF = 40;
	// Extrakosten
	public static final Integer EXTRA_COST = 50;
	// Zuschlag
	public static final Integer ITEM_OVH = 60;
	// Erlösminderung
	public static final Integer PROC_RED = 70;
    
    public static final Integer _defaultValue = 10;
    
    public static Map<String,Integer> getValues() {
        return getValues(OpCaldocitemtypeType.class);
    } 
}

Referencing such a class in groovy with:

OpCaldocitemtypeType.BOM_ITEM

creates an error: Groovy:[Static type checking] - The variable [OpCaldocitemtypeType] is undeclared.

But thats wrong, the include is available, the quick fix to import the class is not functioning.

I only see in the error log:

CodeSelectRequestor: Could not proceed due to null declaring type for org.codehaus.groovy.ast.expr.PropertyExpression@13673e2[object: org.codehaus.groovy.ast.expr.ClassExpression@78f7777[type: de.effectivecompany.app.app.OpCaldocitemtypeType] property: ConstantExpression[BOM_ITEM]]

Regards, Marcel

@wagnerma wagnerma changed the title With Plugin 3.x we can't compile out project anymore With Plugin 3.x we can't compile our project anymore Oct 1, 2018
@wagnerma wagnerma changed the title With Plugin 3.x we can't compile our project anymore With eclispe groovy plugin 3.x we can't compile our project anymore Oct 1, 2018
@eric-milles
Copy link
Member

Do you have a snippet of the Groovy code that has the error? Accessing a public static final field should be no problem. I can't tell from the submission if you are static importing the field, importing the type or referring to the type by name from the same package.

@eric-milles
Copy link
Member

Is it possible you have an extra ".app" in "de.effectivecompany.app.app.OpCaldocitemtypeType"?

@wagnerma
Copy link
Author

wagnerma commented Oct 6, 2018

The package names are all fine. It seems something different. It was not possible to isolate the problem, so I zip you the complete project. You can download the project here: https://drive.google.com/file/d/1zWgTUoJjrSyHlgC2DV98yh10HdPyZU06/view?usp=sharing
It is a gradle project, you can do a gradle project import, I use the newest Eclipse 2018-09 and the 2.5.2 compiler. There you see the strange static compile issues. Hope you can find somthing.

@eric-milles
Copy link
Member

Thanks for the project archive. You may want to remove it from online now. Not sure if you meant to make it public.

@eric-milles
Copy link
Member

Here is what I know so far:

  1. de.effectivecompany.app.cal.serviceimpl.SvBoCalDocCalcForOrderImpl is missing "import de.effectivecompany.util.OptionTools" and "import de.effectivecompany.app.app.OpCaldocitemtypeType"
  2. These two unresolvable types are causing misses in other classes due to shared resolver state (in JDTResolver). This is the root cause.

A couple additional notes:

  1. There were unresolvanle types due to missing dependencies: 'org.apache.poi:poi:4.0.0', 'org.apache.poi:poi-ooxml:4.0.0', 'au.com.bytecode:opencsv:2.4'
  2. You are referencing the 'org.codehaus.groovy:groovy-all:2.5.2:indy' dependency. However, due to the change in the groovy-all artifact in Groovy 2.5, you are not getting the "indy" versions of the Groovy artifacts.
  3. Though you are indicating "indy" compilation in Gradle, Eclipse is not doing "indy" compilation without a compiler config script. It is not strictly necessary but does represent a difference between Eclipse and Gradle builds.

@wagnerma
Copy link
Author

wagnerma commented Oct 8, 2018

You are right, I corrected it. But still some wired things are goning on. The updated project:
https://drive.google.com/file/d/1tH_6_b8M_ly5CZBQJ-r-DXuqNnvW6MWy/view?usp=sharing

@eric-milles
Copy link
Member

Can you give some details on what you mean by "wierd"?

@wagnerma
Copy link
Author

wagnerma commented Oct 8, 2018

Well, for example the SvBoDocNewImpl.groovy, There the plugin says OptionTools import is missing. The quick fix want's to add the import "import de.effectivecompany.util.OptionTools" but it is already there, nothing happens. Adding a ";" behind the "import de.effectivecompany.util.OptionTools", or change something different and save the file, a lot of errors disappears, only one missing method.

@eric-milles eric-milles self-assigned this Oct 8, 2018
@eric-milles eric-milles added the bug label Oct 8, 2018
@eric-milles eric-milles added this to the v3.1.0 milestone Oct 8, 2018
eric-milles added a commit that referenced this issue Oct 8, 2018
- a type name that is not resolvable in one module may be in another
@eric-milles
Copy link
Member

Ready for test

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