This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 247195 - Editor does not open generated Groovy class
Summary: Editor does not open generated Groovy class
Status: NEW
Alias: None
Product: groovy
Classification: Unclassified
Component: Code (show other bugs)
Version: 8.0.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: bruno.flavio
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-17 07:36 UTC by tkellerer
Modified: 2016-09-28 08:10 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot showing the problem (39.76 KB, image/png)
2014-09-17 07:37 UTC, tkellerer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tkellerer 2014-09-17 07:36:41 UTC
I have a Maven project that generates Groovy classes.

The generated classes are shown as a separate package "Generated  Sources (groovy stubs)"

When I open the folder in the Projects window the classes are listed. When I click on a class, the Navigator shows the methods in that class. When I double click the class, an empty editor opens. No filename is shown in the editor's title tab.

In the IDE logfile I can see the following message:

WARNING [org.netbeans.modules.openide.loaders.DataObjectEncodingQueryImplementation]: Invalid DataObject: *****\target\generated-sources\groovy-stubs\test\com\****\PlanningWeekMappingDbTest.java

The class depends on another class for which the following errors can be found in the logfile:

ALL [null]: The file *****/generated-sources/groovy-stubs/test/*****/FoodCampaignsGroovyDbTest.java seems no longer valid!
INFO [org.netbeans.api.java.source.UiUtils]: *****\generated-sources\groovy-stubs\test\*****\FoodCampaignsGroovyDbTest.java@73310fe3:1a96cafd[invalid]
msg
Caused: org.openide.filesystems.FileStateInvalidException: *****\generated-sources\groovy-stubs\test\*****\FoodCampaignsGroovyDbTest.java@73310fe3:1a96cafd[invalid]
	at org.openide.loaders.DataObject.find(DataObject.java:559)
Caused: org.openide.loaders.DataObjectNotFoundException: *****\generated-sources\groovy-stubs\test\*****\FoodCampaignsGroovyDbTest.java@73310fe3:1a96cafd[invalid]
	at org.openide.loaders.DataObject.find(DataObject.java:582)
[catch] at org.netbeans.api.java.source.UiUtils.doOpen(UiUtils.java:355)
	at org.netbeans.api.java.source.UiUtils.open(UiUtils.java:241)
	at org.netbeans.api.java.source.ui.ElementOpen.doOpen(ElementOpen.java:207)
	at org.netbeans.api.java.source.ui.ElementOpen.open(ElementOpen.java:172)
	at org.netbeans.api.java.source.ui.ElementOpen.access$100(ElementOpen.java:67)
	at org.netbeans.api.java.source.ui.ElementOpen$2.run(ElementOpen.java:149)
	at org.netbeans.modules.progress.ui.RunOffEDTImpl$1.run(RunOffEDTImpl.java:150)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1423)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
ALL [null]: The file *****/generated-sources/groovy-stubs/test/*****/FoodCampaignsGroovyDbTest.java seems no longer valid!

(I removed some parts of the file path for confidentiality reasons)

The file is available in the filesystem and I can open it with other editors without problems.
Comment 1 tkellerer 2014-09-17 07:37:26 UTC
Created attachment 149281 [details]
Screenshot showing the problem
Comment 2 tkellerer 2015-09-02 08:18:12 UTC
This is still the same with 8.1beta
Comment 3 bruno.flavio 2016-02-08 23:31:23 UTC
Hello, thank you for reporting this.

Regarding the issue:
Are you trying to open a Java or a Groovy class when this happens?
The file shown in the screenshot appears to be a groovy class but has the .java extension, is this the case?
Comment 4 tkellerer 2016-09-28 08:10:54 UTC
Those are indeed Java classes. 

I checked this with NetBeans 8.2 RC and it still doesn't work properly. 

The classes are generated into "target/generated-sources/groovy-stubs/test". So below that is "com/mycompany/somepackage". 

But NetBeans 8.2 uses "test" as the first part of the package name and thus complains about com.mycompany.somepackage being wrong because the it uses test/com/mycompany/somepackage as the file location and thus expects the classes to be in the package "test.com.mycompany.somepackage".

Note that the Maven project builds fine on the command line. I am the only one in the team using NetBeans. The setup works fine for all the IntelliJ and Eclipse users, so there is nothing I can do about it.