If you're using Streams in Java 8 sooner or later you'll want to use method references. There's a problem when you use the ::new method reference, as in:
It recognises the 'new' keyword and expects stuff to come after it that it's not getting. This then breaks the syntax's ability to recognise any methods in the Java source that follow the usage of the above syntax.
I have a fix. :-)
As a user I can go to Bundles -> Edit Bundles... and select Java -> Language Grammars -> Java and go to anonymous-classes-and-new and change the begin regexp as follows:
original:
begin = '\bnew\b';
fix:
begin = '\b(?<!::)new\b)';
And save. This stops it recognising new when it's prefixed by those colons, and so it just appears in the same way as other method references; and more importantly for me, it goes on to recognise the rest of the methods in that source file.
NB: I forked the repository and made that change to my own working copy preparatory to doing a PR for it, but I'm afraid I don't sufficiently get Textmate bundle development to be able to get it to load! (The bundle loads but it's missing the Java language grammer. I'm guessing some build process needs to happen but I can't see it.) So even though the above is the only change in it, and it works if I just apply the change directly in Bundle Editor, I'm not at current going to attempt to commit it. :-) (EDIT: It's probably because I didn't entityise the < as it appears in the Java.plist XML file. Duh!)
This problem was originally observed in Sublime Text 3 https://github.com/SublimeTextIssues/DefaultPackages/issues/140 which is actually my preferred editor, I just also noticed that Textmate has the same issue and then found that Sublime actually "borrows" files from this Java.tmbundle to supply its syntax highlighting, so thought I'd try to fix it in Textmate first. After I submit this I'm going to go and add a note there to the same effect.
I forked the repository and made that change to my own working copy preparatory to doing a PR for it, but I'm afraid I don't sufficiently get Textmate bundle development to be able to get it to load!
If you just want to test your changes you can use Lightshow ;)
If you're using Streams in Java 8 sooner or later you'll want to use method references. There's a problem when you use the ::new method reference, as in:
It recognises the 'new' keyword and expects stuff to come after it that it's not getting. This then breaks the syntax's ability to recognise any methods in the Java source that follow the usage of the above syntax.
I have a fix. :-)
As a user I can go to Bundles -> Edit Bundles... and select Java -> Language Grammars -> Java and go to
anonymous-classes-and-new
and change thebegin
regexp as follows:original:
fix:
And save. This stops it recognising
new
when it's prefixed by those colons, and so it just appears in the same way as other method references; and more importantly for me, it goes on to recognise the rest of the methods in that source file.NB: I forked the repository and made that change to my own working copy preparatory to doing a PR for it, but I'm afraid I don't sufficiently get Textmate bundle development to be able to get it to load! (The bundle loads but it's missing the Java language grammer. I'm guessing some build process needs to happen but I can't see it.) So even though the above is the only change in it, and it works if I just apply the change directly in Bundle Editor, I'm not at current going to attempt to commit it. :-) (EDIT: It's probably because I didn't entityise the
<
as it appears in the Java.plist XML file. Duh!)This problem was originally observed in Sublime Text 3 https://github.com/SublimeTextIssues/DefaultPackages/issues/140 which is actually my preferred editor, I just also noticed that Textmate has the same issue and then found that Sublime actually "borrows" files from this Java.tmbundle to supply its syntax highlighting, so thought I'd try to fix it in Textmate first. After I submit this I'm going to go and add a note there to the same effect.