Skip to content

Commit

Permalink
GROOVY-10191
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Aug 5, 2021
1 parent 6020475 commit c094959
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1731,11 +1731,11 @@ public void testAnnotationCollectorMultiProject() throws Exception {

//@formatter:off
env.addGroovyClass(paths[1], "com.demo", "MyAnnotation",
"package com.demo\r\n" +
"\r\n" +
"@groovy.transform.AnnotationCollector\r\n" +
"@Deprecated\r\n" +
"@interface MyAnnotation {}\r\n");
"package com.demo\n" +
"\n" +
"@groovy.transform.AnnotationCollector\n" +
"@Deprecated\n" +
"@interface MyAnnotation {}\n");
//@formatter:on

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

//@formatter:off
env.addGroovyClass(paths[1], "com.demo", "Widget",
"package com.demo\r\n" +
"\r\n" +
"@MyAnnotation\r\n" +
"class Widget {}\r\n");
"package com.demo\n" +
"\n" +
"@MyAnnotation\n" +
"class Widget {}\n");
//@formatter:on

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

@Test // GROOVY-10191
public void testInlineConstantMultiProject() throws Exception {
IPath[] paths = createSimpleProject("One", true);

//@formatter:off
env.addGroovyClass(paths[1], "pack", "Type",
"package pack\n" +
"class Type {\n" +
" public static final CONST = 'value'\n" +
" static {\n" +
" throw new NoSuchMethodError('simulate complex field init')\n" +
" }\n" +
"}\n");
//@formatter:on

IPath one = paths[0];
incrementalBuild(one);
paths = createSimpleProject("Two", true);
env.addRequiredProjectWithoutTestCode(paths[0], one);

//@formatter:off
env.addGroovyClass(paths[1], "", "Main",
"class Main {\n" +
" static final prop = pack.Type.CONST\n" +
"}\n");
//@formatter:on

incrementalBuild();
expectingNoProblems();
expectingCompiledClasses("Main");
}

@Test
public void testClosureIncremental() throws Exception {
IPath[] paths = createSimpleProject("Project", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public static Expression transformInlineConstants(final Expression exp, final Cl
// GRECLIPSE end
return ce3;
}
} catch(Exception e) {
} catch (Exception | LinkageError e) {
// ignore, leave property expression in place and we'll report later
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public static Expression transformInlineConstants(final Expression exp, final Cl
configure(exp, ce3);
return ce3;
}
} catch(Exception e) {
} catch (Exception | LinkageError e) {
// ignore, leave property expression in place and we'll report later
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public static Expression transformInlineConstants(final Expression exp, final Cl
configure(exp, ce3);
return ce3;
}
} catch(Exception e) {
} catch (Exception | LinkageError e) {
// ignore, leave property expression in place and we'll report later
}
}
Expand Down

0 comments on commit c094959

Please sign in to comment.