Skip to content

Commit 631bd69

Browse files
authored
Merge pull request #2159 from apache/master
Sync master to release 12.0 beta 6
2 parents 16abbbf + 37fba0a commit 631bd69

9 files changed

Lines changed: 92 additions & 43 deletions

File tree

apisupport/apisupport.wizards/src/org/netbeans/modules/apisupport/project/ui/wizard/action/DataModel.java

Lines changed: 48 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121

2222
import java.io.File;
2323
import java.io.IOException;
24-
import java.lang.reflect.InvocationHandler;
25-
import java.lang.reflect.Method;
26-
import java.lang.reflect.Proxy;
24+
import java.io.Serializable;
2725
import java.util.ArrayList;
2826
import java.util.Arrays;
2927
import java.util.Collections;
@@ -40,7 +38,6 @@
4038
import org.netbeans.modules.apisupport.project.ui.wizard.common.CreatedModifiedFiles;
4139
import org.netbeans.modules.apisupport.project.ui.wizard.common.BasicWizardIterator;
4240
import org.openide.WizardDescriptor;
43-
import org.openide.awt.ActionReference;
4441
import org.openide.filesystems.FileObject;
4542
import org.openide.filesystems.FileSystem;
4643
import org.openide.filesystems.FileUtil;
@@ -253,7 +250,7 @@ private void regenerate() {
253250
}
254251

255252
if (annotations) {
256-
List<ActionReference> refs = new ArrayList<ActionReference>();
253+
List<ActionReferenceModel> refs = new ArrayList<>();
257254
// create layer entry for global menu item
258255
if (globalMenuItemEnabled) {
259256
refs.add(createActionReference(
@@ -624,46 +621,58 @@ void setEdContextSeparatorBefore(boolean separator) {
624621
this.edContextSeparatorBefore = separator;
625622
}
626623

627-
static ActionReference createActionReference(
624+
static class ActionReferenceModel implements Serializable {
625+
String parentPath;
626+
String name;
627+
int beforeSep;
628+
int afterSep;
629+
int position;
630+
631+
public ActionReferenceModel(String parentPath, String name, int beforeSep, int afterSep, int position) {
632+
this.parentPath = parentPath;
633+
this.name = name;
634+
this.beforeSep = beforeSep;
635+
this.afterSep = afterSep;
636+
this.position = position;
637+
}
638+
639+
public String path() {
640+
return parentPath;
641+
}
642+
643+
public int position() {
644+
return position;
645+
}
646+
647+
public String name() {
648+
return name == null ? "" : name;
649+
}
650+
651+
public int separatorBefore() {
652+
return beforeSep;
653+
}
654+
655+
public int separatorAfter() {
656+
return afterSep;
657+
}
658+
659+
@Override
660+
public String toString() {
661+
return "ActionReferenceModel{" + "parentPath=" + parentPath + ", name=" + name + ", beforeSep=" + beforeSep + ", afterSep=" + afterSep + ", position=" + position + '}';
662+
}
663+
664+
665+
}
666+
667+
static ActionReferenceModel createActionReference(
628668
final String parentPath,
629669
final int beforeSep,
630670
final int afterSep,
631671
final int position,
632672
final String name
633673
) {
634-
class H implements InvocationHandler {
635-
@Override
636-
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
637-
if (method.getName().equals("path")) {
638-
return parentPath;
639-
}
640-
if (method.getName().equals("position")) {
641-
return position;
642-
}
643-
if (method.getName().equals("separatorBefore")) {
644-
return beforeSep;
645-
}
646-
if (method.getName().equals("separatorAfter")) {
647-
return afterSep;
648-
}
649-
if (method.getName().equals("name")) {
650-
return name == null ? "" : name;
651-
}
652-
if (method.getName().equals("equals")) {
653-
return this == Proxy.getInvocationHandler(proxy);
654-
}
655-
if (method.getName().equals("hashCode")) {
656-
return hashCode();
657-
}
658-
return null;
659-
}
660-
}
661-
662-
return (ActionReference) Proxy.newProxyInstance(
663-
ActionReference.class.getClassLoader(),
664-
new Class[] { ActionReference.class },
665-
new H()
666-
);
674+
675+
return new ActionReferenceModel(parentPath, name, beforeSep, afterSep, position);
667676
}
668677

669678
void setSFS(FileSystem sfs) {

apisupport/apisupport.wizards/test/unit/src/org/netbeans/modules/apisupport/project/ui/wizard/action/DataModelTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
package org.netbeans.modules.apisupport.project.ui.wizard.action;
2121

2222
import org.netbeans.junit.NbTestCase;
23-
import org.openide.awt.ActionReference;
23+
import org.netbeans.modules.apisupport.project.ui.wizard.action.DataModel.ActionReferenceModel;
2424

2525
/**
2626
* Tests {@link DataModel}.
@@ -34,7 +34,7 @@ public DataModelTest(String name) {
3434
}
3535

3636
public void testActionReferenceCreate() throws Exception {
37-
ActionReference res = DataModel.createActionReference("mypath/sub", 30, 130, 100, "myname");
37+
ActionReferenceModel res = DataModel.createActionReference("mypath/sub", 30, 130, 100, "myname");
3838
assertEquals("mypath/sub", res.path());
3939
assertEquals(100, res.position());
4040
assertEquals("myname", res.name());

ide/languages.yaml/src/org/netbeans/modules/languages/yaml/YamlLexer.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,12 @@ public Token<YamlTokenId> nextToken() {
468468
case ISA_CURLY:
469469
state = ISI_WHITESPACE;
470470
return token(YamlTokenId.TEXT);
471+
case ISI_MUSTACHE:
472+
state = ISI_WHITESPACE;
473+
return token(YamlTokenId.MUSTACHE);
474+
case ISI_MUSTACHE_QUOTE:
475+
state = ISI_WHITESPACE;
476+
return token(YamlTokenId.MUSTACHE);
471477
case ISI_PHP:
472478
state = ISI_WHITESPACE;
473479
return token(YamlTokenId.PHP);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.t.e.s.t. SimpleMustache
2+
k: {{a
3+
.e.o.f.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.t.e.s.t. SimpleMustache
2+
TEXT "k: ", la=2, st=0
3+
MUSTACHE_DELIMITER "{{", st=13
4+
MUSTACHE "a", la=1, st=0
5+
----- EOF -----
6+
7+
<Unnamed test>
8+
----- EOF -----
9+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.t.e.s.t. SimpleMustacheQuote
2+
k: {{ '}}
3+
.e.o.f.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.t.e.s.t. SimpleMustacheQuote
2+
TEXT "k: ", la=2, st=0
3+
MUSTACHE_DELIMITER "{{", st=13
4+
MUSTACHE " '}}", la=1, st=0
5+
----- EOF -----
6+
7+
<Unnamed test>
8+
----- EOF -----
9+

ide/languages.yaml/test/unit/src/org/netbeans/modules/languages/yaml/YamlLexerTest.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,17 @@ public void testNETBEANS_4167() throws Exception {
6565
YamlTokenId.language());
6666
}
6767

68-
public void testIssue246124() throws Exception {
68+
public void testNETBEANS_4370_1() throws Exception {
69+
LexerTestUtilities.checkTokenDump(this, "testfiles/issue_NETBEANS-4370_1.yaml.txt",
70+
YamlTokenId.language());
71+
}
72+
73+
public void testNETBEANS_4370_2() throws Exception {
74+
LexerTestUtilities.checkTokenDump(this, "testfiles/issue_NETBEANS-4370_2.yaml.txt",
75+
YamlTokenId.language());
76+
}
77+
78+
public void testIssue246124() throws Exception {
6979
LexerTestUtilities.checkTokenDump(this, "testfiles/issue246124.yaml",
7080
YamlTokenId.language());
7181
}

java/java.source.base/src/org/netbeans/modules/java/source/parsing/ParameterNameProviderImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ private static String computeKey(Element el) {
208208

209209
static void capCache(LinkedHashMap<String, ?> map) {
210210
Iterator<String> it = map.keySet().iterator();
211-
while (map.size() > MAX_CACHE_SIZE) {
211+
while (map.size() > MAX_CACHE_SIZE && it.hasNext()) {
212212
it.next();
213213
it.remove();
214214
}

0 commit comments

Comments
 (0)