Skip to content

Commit c094959

Browse files
committed
GROOVY-10191
1 parent 6020475 commit c094959

File tree

4 files changed

+44
-12
lines changed

4 files changed

+44
-12
lines changed

base-test/org.eclipse.jdt.groovy.core.tests.builder/src/org/eclipse/jdt/core/groovy/tests/builder/BasicGroovyBuildTests.java

+41-9
Original file line numberDiff line numberDiff line change
@@ -1731,11 +1731,11 @@ public void testAnnotationCollectorMultiProject() throws Exception {
17311731

17321732
//@formatter:off
17331733
env.addGroovyClass(paths[1], "com.demo", "MyAnnotation",
1734-
"package com.demo\r\n" +
1735-
"\r\n" +
1736-
"@groovy.transform.AnnotationCollector\r\n" +
1737-
"@Deprecated\r\n" +
1738-
"@interface MyAnnotation {}\r\n");
1734+
"package com.demo\n" +
1735+
"\n" +
1736+
"@groovy.transform.AnnotationCollector\n" +
1737+
"@Deprecated\n" +
1738+
"@interface MyAnnotation {}\n");
17391739
//@formatter:on
17401740

17411741
IPath annotationProject = paths[0];
@@ -1747,10 +1747,10 @@ public void testAnnotationCollectorMultiProject() throws Exception {
17471747

17481748
//@formatter:off
17491749
env.addGroovyClass(paths[1], "com.demo", "Widget",
1750-
"package com.demo\r\n" +
1751-
"\r\n" +
1752-
"@MyAnnotation\r\n" +
1753-
"class Widget {}\r\n");
1750+
"package com.demo\n" +
1751+
"\n" +
1752+
"@MyAnnotation\n" +
1753+
"class Widget {}\n");
17541754
//@formatter:on
17551755

17561756
fullBuild();
@@ -1822,6 +1822,38 @@ public void testAnnotationCollectorIncremental() throws Exception {
18221822
executeClass(paths[0], "Book", "@NotNull()\n@Length()\n", "");
18231823
}
18241824

1825+
@Test // GROOVY-10191
1826+
public void testInlineConstantMultiProject() throws Exception {
1827+
IPath[] paths = createSimpleProject("One", true);
1828+
1829+
//@formatter:off
1830+
env.addGroovyClass(paths[1], "pack", "Type",
1831+
"package pack\n" +
1832+
"class Type {\n" +
1833+
" public static final CONST = 'value'\n" +
1834+
" static {\n" +
1835+
" throw new NoSuchMethodError('simulate complex field init')\n" +
1836+
" }\n" +
1837+
"}\n");
1838+
//@formatter:on
1839+
1840+
IPath one = paths[0];
1841+
incrementalBuild(one);
1842+
paths = createSimpleProject("Two", true);
1843+
env.addRequiredProjectWithoutTestCode(paths[0], one);
1844+
1845+
//@formatter:off
1846+
env.addGroovyClass(paths[1], "", "Main",
1847+
"class Main {\n" +
1848+
" static final prop = pack.Type.CONST\n" +
1849+
"}\n");
1850+
//@formatter:on
1851+
1852+
incrementalBuild();
1853+
expectingNoProblems();
1854+
expectingCompiledClasses("Main");
1855+
}
1856+
18251857
@Test
18261858
public void testClosureIncremental() throws Exception {
18271859
IPath[] paths = createSimpleProject("Project", true);

base/org.codehaus.groovy25/src/org/apache/groovy/ast/tools/ExpressionUtils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public static Expression transformInlineConstants(final Expression exp, final Cl
263263
// GRECLIPSE end
264264
return ce3;
265265
}
266-
} catch(Exception e) {
266+
} catch (Exception | LinkageError e) {
267267
// ignore, leave property expression in place and we'll report later
268268
}
269269
}

base/org.codehaus.groovy30/src/org/apache/groovy/ast/tools/ExpressionUtils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public static Expression transformInlineConstants(final Expression exp, final Cl
250250
configure(exp, ce3);
251251
return ce3;
252252
}
253-
} catch(Exception e) {
253+
} catch (Exception | LinkageError e) {
254254
// ignore, leave property expression in place and we'll report later
255255
}
256256
}

base/org.codehaus.groovy40/src/org/apache/groovy/ast/tools/ExpressionUtils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public static Expression transformInlineConstants(final Expression exp, final Cl
250250
configure(exp, ce3);
251251
return ce3;
252252
}
253-
} catch(Exception e) {
253+
} catch (Exception | LinkageError e) {
254254
// ignore, leave property expression in place and we'll report later
255255
}
256256
}

0 commit comments

Comments
 (0)