Skip to content

Commit 017ddb7

Browse files
authored
Merge pull request #1944 from apache/master
sync master to release 113 branch for beta3 (extra time)
2 parents e6797e8 + e198d0d commit 017ddb7

File tree

6 files changed

+53
-4
lines changed

6 files changed

+53
-4
lines changed

apisupport/apisupport.ant/src/org/netbeans/modules/apisupport/project/ui/customizer/SingleModuleProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public final class SingleModuleProperties extends ModuleProperties {
118118
public static final String SPEC_VERSION_BASE = "spec.version.base"; // NOI18N
119119
/** @see "#66278" */
120120
public static final String JAVAC_COMPILERARGS = "javac.compilerargs"; // NOI18N
121-
static final String[] SOURCE_LEVELS = {"1.4", "1.5", "1.6", "1.7", "1.8", "9", "10", "11", "12"}; // NOI18N
121+
static final String[] SOURCE_LEVELS = {"1.4", "1.5", "1.6", "1.7", "1.8", "9", "10", "11", "12", "13", "14"}; // NOI18N
122122
private final static Map<String, String> DEFAULTS;
123123

124124
private static final Logger LOG = Logger.getLogger(SingleModuleProperties.class.getName());

groovy/gradle.java/src/org/netbeans/modules/gradle/java/classpath/ClassPathProviderImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ private ClassPath createMultiplexClassPath(ClassPath modulePath, ClassPath class
315315

316316
public boolean hasModuleInfo() {
317317
GradleJavaProject gjp = GradleJavaProject.get(ClassPathProviderImpl.this.project);
318-
GradleJavaSourceSet ss = gjp.getSourceSets().get(group);
318+
GradleJavaSourceSet ss = gjp != null ? gjp.getSourceSets().get(group) : null;
319319
return ss != null && ss.findResource(MODULE_INFO_JAVA, false, GradleJavaSourceSet.SourceType.JAVA) != null;
320320
}
321321

groovy/gradle.java/src/org/netbeans/modules/gradle/java/queries/GradleBinaryForSource.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ public Res(Project prj, String sourceSetName, boolean resource) {
9393

9494
@Override
9595
public URL[] getRoots() {
96-
GradleJavaSourceSet ss = GradleJavaProject.get(prj).getSourceSets().get(sourceSetName);
96+
GradleJavaProject gjp = GradleJavaProject.get(prj);
97+
GradleJavaSourceSet ss = gjp != null ? gjp.getSourceSets().get(sourceSetName) : null;
9798
if (ss == null) {
9899
return new URL[0];
99100
}

java/java.source.base/src/org/netbeans/api/java/source/SourceUtils.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,11 @@ public static boolean checkTypesAssignable(CompilationInfo info, TypeMirror from
196196

197197
public static TypeMirror getBound(WildcardType wildcardType) {
198198
Type.TypeVar bound = ((Type.WildcardType)wildcardType).bound;
199-
return bound != null ? bound.bound : null;
199+
try {
200+
return bound != null ? bound.bound : null;
201+
} catch (NoSuchFieldError err) {
202+
return bound != null ? bound.getUpperBound() : null;
203+
}
200204
}
201205

202206
/**
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package sourceutils;
20+
21+
public class TestGetBound<T extends TestGetBoundExtra<? extends String>> {
22+
}
23+
class TestGetBoundExtra<T extends CharSequence> {}

java/java.source.base/test/unit/src/org/netbeans/api/java/source/SourceUtilsTest.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package org.netbeans.api.java.source;
2121

22+
import com.sun.source.tree.Tree;
2223
import java.io.ByteArrayInputStream;
2324
import java.io.File;
2425
import java.io.IOException;
@@ -38,7 +39,12 @@
3839
import javax.lang.model.element.ElementKind;
3940
import javax.lang.model.element.ExecutableElement;
4041
import javax.lang.model.element.TypeElement;
42+
import javax.lang.model.element.TypeParameterElement;
4143
import javax.lang.model.element.VariableElement;
44+
import javax.lang.model.type.DeclaredType;
45+
import javax.lang.model.type.TypeMirror;
46+
import javax.lang.model.type.TypeVariable;
47+
import javax.lang.model.type.WildcardType;
4248
import javax.lang.model.util.ElementFilter;
4349
import javax.swing.event.ChangeListener;
4450
import org.netbeans.api.java.classpath.ClassPath;
@@ -428,6 +434,21 @@ public void testDollarSourceName() throws Exception {
428434
assertEquals("TestDollarSourceName.java", f.getNameExt());
429435
}
430436

437+
public void testGetBound() throws Exception {
438+
//only a scatch of the test, add testcases as needed:
439+
prepareTest();
440+
441+
TypeElement test = info.getElements().getTypeElement("sourceutils.TestGetBound");
442+
443+
assertNotNull(test);
444+
445+
TypeParameterElement typeParam = test.getTypeParameters().get(0);
446+
TypeMirror outerBound = ((TypeVariable) typeParam.asType()).getUpperBound();
447+
448+
TypeMirror bound = SourceUtils.getBound((WildcardType) ((DeclaredType) outerBound).getTypeArguments().get(0));
449+
assertEquals("java.lang.CharSequence", String.valueOf(bound));
450+
}
451+
431452
//<editor-fold defaultstate="collapsed" desc="Helper methods & Mock services">
432453

433454
private void prepareTest() throws Exception {

0 commit comments

Comments
 (0)