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

Can't rename classes in newly created maven project #3526

Closed
2 of 3 tasks
mbien opened this issue Jan 28, 2022 · 6 comments
Closed
2 of 3 tasks

Can't rename classes in newly created maven project #3526

mbien opened this issue Jan 28, 2022 · 6 comments
Assignees
Labels
Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) kind:bug Bug report or fix Maven [ci] enable "build tools" tests priority:high High priority issue that should, if possible, be fixed in next release
Milestone

Comments

@mbien
Copy link
Member

mbien commented Jan 28, 2022

Apache NetBeans version

Latest release candidate

What happened

see title, log:

SEVERE [org.openide.util.RequestProcessor]: Error in RequestProcessor org.netbeans.modules.refactoring.spi.impl.ParametersPanel$12
java.lang.IllegalArgumentException: file:/tmp/mavenproject1/src/test/java is not a valid classpath entry; it must end with a slash.
	at org.netbeans.modules.java.classpath.SimplePathResourceImplementation.verify(SimplePathResourceImplementation.java:90)
	at org.netbeans.modules.java.classpath.SimplePathResourceImplementation.verify(SimplePathResourceImplementation.java:43)
	at org.netbeans.modules.java.classpath.SimplePathResourceImplementation.<init>(SimplePathResourceImplementation.java:108)
	at org.netbeans.spi.java.classpath.support.ClassPathSupport.createResource(ClassPathSupport.java:54)
	at org.netbeans.spi.java.classpath.support.ClassPathSupport.createClassPath(ClassPathSupport.java:124)
	at org.netbeans.modules.testng.DefaultPlugin.getOppositeLocation(DefaultPlugin.java:242)
	at org.netbeans.modules.testng.DefaultPlugin.getTestLocation(DefaultPlugin.java:183)
	at org.netbeans.modules.testng.GoToOppositeAction.appliesTo(GoToOppositeAction.java:335)
	at org.netbeans.modules.refactoring.java.ui.RenamePanel$2.run(RenamePanel.java:158)
	at org.netbeans.modules.refactoring.java.ui.RenamePanel$2.run(RenamePanel.java:113)
	at org.netbeans.api.java.source.JavaSource$MultiTask.run(JavaSource.java:504)
	at org.netbeans.modules.parsing.impl.TaskProcessor.callUserTask(TaskProcessor.java:586)
	at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:132)
	at org.netbeans.modules.parsing.api.ParserManager$UserTaskAction.run(ParserManager.java:116)
	at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:181)
	at org.netbeans.modules.parsing.impl.TaskProcessor$2.call(TaskProcessor.java:178)
	at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153)
	at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335)
	at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118)
	at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67)
	at org.netbeans.modules.parsing.impl.TaskProcessor.runUserTask(TaskProcessor.java:178)
	at org.netbeans.modules.parsing.api.ParserManager.parse(ParserManager.java:83)
	at org.netbeans.api.java.source.JavaSource.runUserActionTaskImpl(JavaSource.java:454)
	at org.netbeans.api.java.source.JavaSource.runUserActionTask(JavaSource.java:425)
	at org.netbeans.modules.refactoring.java.ui.RenamePanel.initialize(RenamePanel.java:184)
	at org.netbeans.modules.refactoring.spi.impl.ParametersPanel$12.run(ParametersPanel.java:641)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)

How to reproduce

  1. create new maven project ("Java Applicaiton")
  2. put cursor over class name, press CTRL+R

rename dialog with "please wait..." appears, exception in log.

Did this work correctly in an earlier version?

  • This used to work!

Operating System

linux

JDK

17.0.2

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

java.lang.IllegalArgumentException: file:/tmp/mavenproject1/src/test/java is not a valid classpath entry; it must end with a slash.

Indicates that it is adding the test folder to the cp, but there is no test folder in the new project template.

creating empty ./src/test/java fixes it.

reproducible in 13rc2

Are you willing to submit a pull request?

  • Yes I am willing to submit a PR!

Code of Conduct

@mbien mbien added kind:bug Bug report or fix Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) Maven [ci] enable "build tools" tests priority:high High priority issue that should, if possible, be fixed in next release labels Jan 28, 2022
@mbien
Copy link
Member Author

mbien commented Jan 28, 2022

pinging @sdedic since it might be caused by the updates to maven templates (I haven't checked).

@sdedic sdedic self-assigned this Jan 28, 2022
@neilcsmith-net
Copy link
Member

neilcsmith-net commented Jan 28, 2022

Seems to be lack of a src/test/java folder, or expectation it's there. Just adding that fixes it. (had missed that in the report!) Same bug is reproducible in 12.6 too. Would be great to get fixed in 13 though.

@neilcsmith-net neilcsmith-net added this to the NB13 milestone Jan 28, 2022
@mbien
Copy link
Member Author

mbien commented Jan 28, 2022

good to know that it is already reproducible in 12.6. This means its not the fault of the new maven templates.

We should probably try to fix it in a way so that it doesn't require the empty folders. I am just wondering if other functions are also affected by not having the folder. (maybe add the folders anyway?)

@sdedic
Copy link
Member

sdedic commented Jan 28, 2022

This will be even more twisted (if I didn't overlook something obvious); URL returned for test source root is different when the directory physically exists (ends with /) and when it does not (without /) - which is bad of itself, as URLs are often used as map keys. I wonder why it worked in the past - going to debug 12.4 and delivery in parallel.

@ebresie
Copy link
Contributor

ebresie commented Jan 28, 2022

Is this a Java 17-sim? I see reference to small change in 17 release notes related to IllegalArgumentException.

sdedic added a commit to sdedic/incubator-netbeans that referenced this issue Jan 30, 2022
neilcsmith-net added a commit that referenced this issue Jan 31, 2022
#3526: Retain traling / for non-existing directories.
@neilcsmith-net
Copy link
Member

Closing as issue fixed for 13-rc3.

@mbien added folders is a useful conversation for elsewhere. May benefit from test and resources folders being in initial template. Both seem to cause users confusion at times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) kind:bug Bug report or fix Maven [ci] enable "build tools" tests priority:high High priority issue that should, if possible, be fixed in next release
Projects
None yet
Development

No branches or pull requests

4 participants