[jira] [Commented] (NETBEANS-3802) Hint suggests invalid replacement with lambda for implementations of interfaces with only default methods

2021-11-28 Thread Gregory Williams (Jira)


[ 
https://issues.apache.org/jira/browse/NETBEANS-3802?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17450124#comment-17450124
 ] 

Gregory Williams commented on NETBEANS-3802:


Added *Affects Version/s* of {{{}12.5{}}}, since I've just seen the same issue 
there, but probably affects at least all versions between the original report 
(11.2) and that.

> Hint suggests invalid replacement with lambda for implementations of 
> interfaces with only default methods
> -
>
> Key: NETBEANS-3802
> URL: https://issues.apache.org/jira/browse/NETBEANS-3802
> Project: NetBeans
>  Issue Type: Bug
>  Components: java - Hints
>Affects Versions: 11.2, 12.5
> Environment: JDK 13
>Reporter: dennis lucero
>Priority: Minor
>  Labels: hints
>
> {code:java}
> interface Dog {
> default void run() {
> }
> default void bark() {
> }
> }
> public static void foo() {
> final Dog dog = new Dog() {
> @Override
> public void bark() {
> System.out.println("Woof");
> }
> };
> }
> {code}
> For this code NetBeans has a hint stating
> {quote}This anonymous inner class creation can be turned into a lambda 
> expression.
> {quote}
> in the line with {{new Dog()}}. Replacing the code using the hint results in
> {code:java}
> final Dog dog = () -> {
> System.out.println("Woof");
> };
> {code}
> which is invalid code
> {quote}incompatible types: Dog is not a functional interface
> no abstract method found in interface Dog
> {quote}
> (Real world example: 
> http://jdbi.org/apidocs/org/jdbi/v3/core/statement/SqlLogger.html This style 
> of interfaces would also be a nice alternative to Swing’s 
> {{*Listener}}/{{*Adapter}} pairs.)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



[jira] [Updated] (NETBEANS-3802) Hint suggests invalid replacement with lambda for implementations of interfaces with only default methods

2021-11-28 Thread Gregory Williams (Jira)


 [ 
https://issues.apache.org/jira/browse/NETBEANS-3802?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gregory Williams updated NETBEANS-3802:
---
Affects Version/s: 12.5

> Hint suggests invalid replacement with lambda for implementations of 
> interfaces with only default methods
> -
>
> Key: NETBEANS-3802
> URL: https://issues.apache.org/jira/browse/NETBEANS-3802
> Project: NetBeans
>  Issue Type: Bug
>  Components: java - Hints
>Affects Versions: 11.2, 12.5
> Environment: JDK 13
>Reporter: dennis lucero
>Priority: Minor
>  Labels: hints
>
> {code:java}
> interface Dog {
> default void run() {
> }
> default void bark() {
> }
> }
> public static void foo() {
> final Dog dog = new Dog() {
> @Override
> public void bark() {
> System.out.println("Woof");
> }
> };
> }
> {code}
> For this code NetBeans has a hint stating
> {quote}This anonymous inner class creation can be turned into a lambda 
> expression.
> {quote}
> in the line with {{new Dog()}}. Replacing the code using the hint results in
> {code:java}
> final Dog dog = () -> {
> System.out.println("Woof");
> };
> {code}
> which is invalid code
> {quote}incompatible types: Dog is not a functional interface
> no abstract method found in interface Dog
> {quote}
> (Real world example: 
> http://jdbi.org/apidocs/org/jdbi/v3/core/statement/SqlLogger.html This style 
> of interfaces would also be a nice alternative to Swing’s 
> {{*Listener}}/{{*Adapter}} pairs.)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

-
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



[jira] [Created] (NETBEANS-5705) Java editor uses obsolete lexer token sequence

2021-05-21 Thread Gregory Williams (Jira)
Gregory Williams created NETBEANS-5705:
--

 Summary: Java editor uses obsolete lexer token sequence
 Key: NETBEANS-5705
 URL: https://issues.apache.org/jira/browse/NETBEANS-5705
 Project: NetBeans
  Issue Type: Bug
  Components: java - Editor
Affects Versions: 12.3
 Environment: *Product Version:* Apache NetBeans IDE 12.3

*Java:* 1.8.0_272; OpenJDK 64-Bit Server VM 25.272-b10

*Runtime:* OpenJDK Runtime Environment 1.8.0_272-b10

*System:* Linux version 5.8.18-100.fc31.x86_64 running on amd64; UTF-8; en_GB 
(nb)

*User directory:* /home/redacted/snap/netbeans/common/data/12.3

*Cache directory:* /home/redacted/snap/netbeans/common/cache/12.3
Reporter: Gregory Williams


This has happened a few times whilst editing some Java 8 code, but I've not 
managed to pin down exactly which step/syntax it is that's causing it:
{code:java}
java.util.ConcurrentModificationException: Caller uses obsolete token sequence 
which is no longer valid. Underlying token hierarchy has been modified by 
insertion or removal or a custom language embedding was 
created.TS.modCount=600, tokenList.modCount()=613, rootModCount=613
Please report a bug against a module that calls lexer's code e.g. java, php 
etc. but not the lexer module itself.
at 
org.netbeans.api.lexer.TokenSequence.checkValid(TokenSequence.java:784)
at 
org.netbeans.api.lexer.TokenSequence.moveIndex(TokenSequence.java:568)
at 
org.netbeans.modules.java.editor.base.semantic.TokenList.resetToIndex(TokenList.java:372)
at 
org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.visitExpressionStatement(SemanticHighlighterBase.java:762)
at 
org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.visitExpressionStatement(SemanticHighlighterBase.java:280)
at 
com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1555)
at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
at 
org.netbeans.api.java.source.support.CancellableTreePathScanner.scan(CancellableTreePathScanner.java:69)
at 
org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:1022)
at 
org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:280)
at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:90)
at com.sun.source.util.TreeScanner.scan(TreeScanner.java:105)
at 
org.netbeans.api.java.source.support.CancellableTreePathScanner.scan(CancellableTreePathScanner.java:78)
at com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:250)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1074)
at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
at 
org.netbeans.api.java.source.support.CancellableTreePathScanner.scan(CancellableTreePathScanner.java:69)
at 
org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:1022)
at 
org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.visitMethod(SemanticHighlighterBase.java:836)
at 
org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.visitMethod(SemanticHighlighterBase.java:280)
at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:940)
at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
at 
org.netbeans.api.java.source.support.CancellableTreePathScanner.scan(CancellableTreePathScanner.java:69)
at 
org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:1022)
at 
org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:280)
at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:90)
at com.sun.source.util.TreeScanner.scan(TreeScanner.java:105)
at 
org.netbeans.api.java.source.support.CancellableTreePathScanner.scan(CancellableTreePathScanner.java:78)
at 
org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.visitClass(SemanticHighlighterBase.java:944)
at 
org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.visitClass(SemanticHighlighterBase.java:280)
at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:846)
at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
at 
org.netbeans.api.java.source.support.CancellableTreePathScanner.scan(CancellableTreePathScanner.java:69)
at 
org.netbeans.modules.java.editor.base.semantic.Sema