-
Notifications
You must be signed in to change notification settings - Fork 913
prevent attempt to create method that will fail for missing return type #8605
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
base: master
Are you sure you want to change the base?
Conversation
you have to pick one of the following keywords for it to work: simply edit the PR text and it should update |
|
There is still an issue with my test. It passes with the solution in place, but also when I remove the solution by always accepting any value for the returnType. This is no good, since a test is only worth its pay when it becomes red for the proper reason at least once in its life. 😞 |
I have added a test to ensure that the correct fix is proposed when the return type is known. |
matthiasblaesing
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionally this looks good. I added two inline comments regarding wording/formatting. Please check them, make adjustments and squash changes into a single commit and rebase onto current master.
java/java.hints/src/org/netbeans/modules/java/hints/errors/CreateElement.java
Show resolved
Hide resolved
java/java.hints/test/unit/src/org/netbeans/modules/java/hints/errors/CreateElementTest.java
Outdated
Show resolved
Hide resolved
…ateElement.java Co-authored-by: Matthias Bläsing <mblaesing@doppel-helix.eu>
desc: The code in BreadCrumbComponent reads the fields from the Dimension class. These fields are integers. So the code encounters an implicit case. This is problematic for several reasons: 1 - casting leads to an error [repeat] /home/bwalker/src/netbeans/ide/editor.breadcrumbs/src/org/netbeans/modules/editor/breadcrumbs/BreadCrumbComponent.java:166: warning: [lossy-conversions] implicit cast from double to int in compound assignment is possibly lossy [repeat] xTotal += sizes[i] = preferedSize.width; [repeat] ^ [repeat] /home/bwalker/src/netbeans/ide/editor.breadcrumbs/src/org/netbeans/modules/editor/breadcrumbs/BreadCrumbComponent.java:193: warning: [lossy-conversions] implicit cast from double to int in compound assignment is possibly lossy [repeat] elemX += sizes[i]; [repeat] ^ 2 - There is no need for floating point precision here. testing: built and executed with no issues.
Fix "Open source in editor button" Fix loading of bundle files from default package @
Create expected code depending on java.version string
- handle new namespaces - added PFE components - added missing components
compilationinfo.getElements() in inner loop prevented the JVM from inlining calls into the loop body. Moving it out of the loop improves performance by 10x in files with many fields. rest is cleanup
- JDK 25+ contains JDK-8353950 already - no patching needed - avoids trouble with ASM or other unexpected interactions downgraded classfile version of the agent to 8, so that the JDK warning msg popup can show.
- all lucene deprecations fixed - javac warnings fixed - JDK 17 language level and other cleanup
VanillaPartialParser: - partial reparse verification is now controlled by the log level - improved logging - removed some reflective calls Tiny, JavaCompletionItem: - some enums can be now used directly GeneratorUtilities, ClipboardHandler: - remove dead string template code - minor cleanup
Adds a new method to GradleDistributionManager to query the current (latest) version from the Gradle web service. Adds support for passing a Gradle version into TemplateOperation.InitOperation that is passed in to GradleConnector.useGradleVersion Passes the current version in to the init step in the wizard. Replaces sometimes temperamental support added in apache#7029
NetBeans allows users to configure whether to keep the occurence hightlighting when the cursor is moved off the origin symbol. If "Keep Marks" is enabled the highlights are kept until another symbol is marked by the caret. If it is disabled the highlights are removed once the caret is not on the symbol anymore. There are two problems: - the CSL integration of OccurrenceFinder ignores updates with empty highlights (essentially "Keep Marks" was always on for CSL languages) - the marks are cleared always and thus without the problem in the CSL integration would act as if "Keep Marks" is always off
- failing test cases disabled - tested on JDK 17, 21 and 25
… Configuration Fixes apache#8314 : Missing domainsfolder Setting for Payara Services Configuration Replaced string comparison with Boolean.TRUE.toString().equals(...) by Boolean.parseBoolean(...) Update enterprise/payara.common/src/org/netbeans/modules/payara/common/actions/StopServerAction.java Co-Authored-By: Matthias Bläsing <mblaesing@doppel-helix.eu>
…run non-test for `false` and test for `true`). Following the `project` launch configuration setting, if present.
…r accepting code suggestions
- added missing components - added tag name check where needed - fix typos
- JDK javadoc icons switched from png to svg minor cleanup - no need to disable linedoc anymore since dangling comment warnings were fixed - remove unused dependency
those test cases were very slow and inherited down to many other test classes. this made running hint tests slow from the IDE.
…rted multiple times Stacktrace for problem: java.lang.IllegalStateException: Duplicate key null (attempted merging values /home/patton/TILED-PROGETTO/victores-demo/model/src/testBenchmark/java and /home/patton/TILED-PROGETTO/victores-demo/model/src/testIntegration/java) at java.base/java.util.stream.Collectors.duplicateKeyException(Collectors.java:135) at java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:182) at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133) at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939) at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762) at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276) at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133) at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) at org.netbeans.modules.gradle.test.GradleTestProgressListener.searchLocation(GradleTestProgressListener.java:358) at org.netbeans.modules.gradle.test.GradleTestProgressListener.caseFinish(GradleTestProgressListener.java:256) at org.netbeans.modules.gradle.test.GradleTestProgressListener.processTestProgress(GradleTestProgressListener.java:129) at org.netbeans.modules.gradle.test.GradleTestProgressListener.statusChanged(GradleTestProgressListener.java:94) at org.netbeans.modules.gradle.execute.GradleDaemonExecutor$1ProgressLookupListener.lambda$statusChanged$0(GradleDaemonExecutor.java:151) at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45) at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287) at org.netbeans.modules.gradle.execute.GradleDaemonExecutor$1ProgressLookupListener.statusChanged(GradleDaemonExecutor.java:151) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36) at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44) at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:268) at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:170) at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:160) at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37) at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:92) at jdk.proxy21/jdk.proxy21.$Proxy82.statusChanged(Unknown Source) at org.gradle.tooling.internal.consumer.parameters.BuildProgressListenerAdapter.broadcastTestProgressEvent(BuildProgressListenerAdapter.java:392) at org.gradle.tooling.internal.consumer.parameters.BuildProgressListenerAdapter.onEvent(BuildProgressListenerAdapter.java:354) at org.gradle.tooling.internal.consumer.parameters.FailsafeBuildProgressListenerAdapter.onEvent(FailsafeBuildProgressListenerAdapter.java:39) at org.gradle.tooling.internal.consumer.parameters.FailsafeBuildProgressListenerAdapter.onEvent(FailsafeBuildProgressListenerAdapter.java:39) at org.gradle.tooling.internal.provider.ProviderConnection$BuildProgressListenerInvokingBuildEventConsumer.dispatch(ProviderConnection.java:441) at org.gradle.tooling.internal.provider.ProblemAdditionalDataRemapper.dispatch(ProblemAdditionalDataRemapper.java:55) at org.gradle.tooling.internal.provider.StreamedValueConsumer.dispatch(StreamedValueConsumer.java:43) at org.gradle.launcher.daemon.client.DaemonClient.monitorBuild(DaemonClient.java:260) at org.gradle.launcher.daemon.client.DaemonClient.executeBuild(DaemonClient.java:209) at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:172) at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:97) at org.gradle.tooling.internal.provider.DaemonBuildActionExecuter.execute(DaemonBuildActionExecuter.java:44) at org.gradle.tooling.internal.provider.DaemonBuildActionExecuter.execute(DaemonBuildActionExecuter.java:30) at org.gradle.tooling.internal.provider.LoggingBridgingBuildActionExecuter.execute(LoggingBridgingBuildActionExecuter.java:59) at org.gradle.tooling.internal.provider.LoggingBridgingBuildActionExecuter.execute(LoggingBridgingBuildActionExecuter.java:38) at org.gradle.tooling.internal.provider.ProviderConnection.run(ProviderConnection.java:273) at org.gradle.tooling.internal.provider.ProviderConnection.run(ProviderConnection.java:181) at org.gradle.tooling.internal.provider.DefaultConnection.getModel(DefaultConnection.java:151) at org.gradle.tooling.internal.consumer.connection.CancellableModelBuilderBackedModelProducer.produceModel(CancellableModelBuilderBackedModelProducer.java:53) at org.gradle.tooling.internal.consumer.connection.PluginClasspathInjectionSupportedCheckModelProducer.produceModel(PluginClasspathInjectionSupportedCheckModelProducer.java:38) at org.gradle.tooling.internal.consumer.connection.AbstractConsumerConnection.run(AbstractConsumerConnection.java:64) at org.gradle.tooling.internal.consumer.connection.ParameterValidatingConsumerConnection.run(ParameterValidatingConsumerConnection.java:49) at org.gradle.tooling.internal.consumer.DefaultBuildLauncher$1.run(DefaultBuildLauncher.java:96) at org.gradle.tooling.internal.consumer.DefaultBuildLauncher$1.run(DefaultBuildLauncher.java:88) at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.run(LazyConsumerActionExecutor.java:143) at org.gradle.tooling.internal.consumer.connection.CancellableConsumerActionExecutor.run(CancellableConsumerActionExecutor.java:45) at org.gradle.tooling.internal.consumer.connection.ProgressLoggingConsumerActionExecutor.run(ProgressLoggingConsumerActionExecutor.java:61) at org.gradle.tooling.internal.consumer.connection.RethrowingErrorsConsumerActionExecutor.run(RethrowingErrorsConsumerActionExecutor.java:38) at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:66) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64) at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:48) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) at java.base/java.lang.Thread.run(Thread.java:1583) Caused: org.gradle.tooling.ListenerFailedException: Could not execute build using connection to Gradle installation '/home/patton/.gradle/wrapper/dists/gradle-9.0.0-bin/d6wjpkvcgsg3oed0qlfss3wgl/gradle-9.0.0'. at org.gradle.tooling.internal.consumer.ConnectionExceptionTransformer.transform(ConnectionExceptionTransformer.java:71) at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:42) at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:68) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64) at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:48) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) at java.base/java.lang.Thread.run(Thread.java:1583) at org.gradle.tooling.internal.consumer.BlockingResultHandler.getResult(BlockingResultHandler.java:46) at org.gradle.tooling.internal.consumer.DefaultBuildLauncher.run(DefaultBuildLauncher.java:82) at org.netbeans.modules.gradle.execute.GradleDaemonExecutor.run(GradleDaemonExecutor.java:261) at org.netbeans.core.execution.RunClassThread.doRun(RunClassThread.java:131) at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45) at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287) [catch] at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:80)
java 26 op codes + minor bugfix release
- close stream on exception - handle lines with '-1,-1' coordinate - log and continue on NumberFormatException
Hint triggers on the javac error code and offers to append a default case to the switch block. other changes: - checked all JavaFix impls for TreePath access without TreePathHandle - removed some redundant code from tests extending ErrorHintsTestBase commit notes: - originally based on an old draft PR (apache#3440) from Sandeep Mishra - finished the impl and aligned the code to the changed codebase (e.g TreeShims is no more) - added tests Co-Authored-By: mishrasandeep <sandeep.s.mishra@oracle.com>
…only sometimes inherited, the Java import analysis needs to account for that.
- make exact search mode follow the case sensitivity settings - add missing exact search instructions to file search label (other windows had those) - file search: selection should stick to first item until user changes selection. Async search could otherwise insert better matches above the selected item - disable "prefer opened projects" by default - CI: enabled tests - other minor improvements the "prefer opened projects" setting can lead to confusing results when good matches are displayed far away from the first (worse) match, potentially outside of the visible viewport. The implementation itself works correctly but it might be better to change it into a filter instead of model comparator in future and consolidate the UI/settings of the 3 search dialogs.
- removed the setting from global options and moved it to the three search windows - generics and related language renovationss - file search: renamed "Search by Folder" to "Search by Path" - updated mnemonics
Hide the Instance type in Local Server instance
generates less code
moved the null check to a central place to avoid redundant getter calls to the model which doesn't cache values.
- tab group will now contain 4 views: Projects, Files, Favorites and Services - will be opened with the already existing on-first-project-open mechanism - the very first on-editor-open event will also open the Favorites tab
some tests are sensitive to additionally opened top components
…oloc:/...', and add some comments about this URL scheme.
|
@homberghp this PR looks strange. It lists 199 commits - is this a rebase gone wrong? |
closes #8594
Implementation:
Add method to test that the return type given is useable by the CreateMethod fix.
Uses that method in 4 places in
CreateElement.Added test to verify that no fix is suggested by create element.
Added test data file with minimal working example as given in #8594
With this fix in place, the hint to create a method is not shown; instead, the line with the combination of var type and unknown method call is flagged as an error.
^Add meaningful description above
Click to collapse/expand PR instructions
By opening a pull request you confirm that, unless explicitly stated otherwise, the changes -
Please make sure (eg.
git log) that all commits have a valid name and email address for you in the Author field.If you're a first time contributor, see the Contributing guidelines for more information.
If you're a committer, please label the PR before pressing "Create pull request" so that the right test jobs can run.
PR approval and merge checklist:
If this PR targets the delivery branch: don't merge. (full wiki article)