diff --git a/base/org.codehaus.groovy30/src/org/codehaus/groovy/antlr/AntlrParserPlugin.java b/base/org.codehaus.groovy30/src/org/codehaus/groovy/antlr/AntlrParserPlugin.java index d4222d1bea..92c4f24ec4 100644 --- a/base/org.codehaus.groovy30/src/org/codehaus/groovy/antlr/AntlrParserPlugin.java +++ b/base/org.codehaus.groovy30/src/org/codehaus/groovy/antlr/AntlrParserPlugin.java @@ -1180,8 +1180,20 @@ protected void throwsList(AST node, List list) { } else { name = identifier(node); } + /* GRECLIPSE edit ClassNode exception = ClassHelper.make(name); + */ + ClassNode exception = makeClassNode(name); + // GRECLIPSE end configureAST(exception, node); + // GRECLIPSE add + if (isType(DOT, node)) { + GroovySourceAST type = (GroovySourceAST) node.getFirstChild().getNextSibling(); + exception.setNameStart2(locations.findOffset(type.getLine(), type.getColumn())); + exception.setEnd(locations.findOffset(type.getLineLast(), type.getColumnLast())); + exception.setLastLineNumber(type.getLineLast()); exception.setLastColumnNumber(type.getColumnLast()); + } + // GRECLIPSE end list.add(exception); AST next = node.getNextSibling(); if (next != null) throwsList(next, list); diff --git a/base/org.codehaus.groovy40/src/org/codehaus/groovy/antlr/AntlrParserPlugin.java b/base/org.codehaus.groovy40/src/org/codehaus/groovy/antlr/AntlrParserPlugin.java index 4f2b749ee2..598ed6f64f 100644 --- a/base/org.codehaus.groovy40/src/org/codehaus/groovy/antlr/AntlrParserPlugin.java +++ b/base/org.codehaus.groovy40/src/org/codehaus/groovy/antlr/AntlrParserPlugin.java @@ -1180,8 +1180,20 @@ protected void throwsList(AST node, List list) { } else { name = identifier(node); } + /* GRECLIPSE edit ClassNode exception = ClassHelper.make(name); + */ + ClassNode exception = makeClassNode(name); + // GRECLIPSE end configureAST(exception, node); + // GRECLIPSE add + if (isType(DOT, node)) { + GroovySourceAST type = (GroovySourceAST) node.getFirstChild().getNextSibling(); + exception.setNameStart2(locations.findOffset(type.getLine(), type.getColumn())); + exception.setEnd(locations.findOffset(type.getLineLast(), type.getColumnLast())); + exception.setLastLineNumber(type.getLineLast()); exception.setLastColumnNumber(type.getColumnLast()); + } + // GRECLIPSE end list.add(exception); AST next = node.getNextSibling(); if (next != null) throwsList(next, list); diff --git a/base/org.codehaus.groovy50/src/org/codehaus/groovy/antlr/AntlrParserPlugin.java b/base/org.codehaus.groovy50/src/org/codehaus/groovy/antlr/AntlrParserPlugin.java index 02ac9d93ef..9025cb4ea8 100644 --- a/base/org.codehaus.groovy50/src/org/codehaus/groovy/antlr/AntlrParserPlugin.java +++ b/base/org.codehaus.groovy50/src/org/codehaus/groovy/antlr/AntlrParserPlugin.java @@ -1182,8 +1182,20 @@ protected void throwsList(AST node, List list) { } else { name = identifier(node); } + /* GRECLIPSE edit ClassNode exception = ClassHelper.make(name); + */ + ClassNode exception = makeClassNode(name); + // GRECLIPSE end configureAST(exception, node); + // GRECLIPSE add + if (isType(DOT, node)) { + var type = (GroovySourceAST) node.getFirstChild().getNextSibling(); + exception.setNameStart2(locations.findOffset(type.getLine(), type.getColumn())); + exception.setEnd(locations.findOffset(type.getLineLast(), type.getColumnLast())); + exception.setLastLineNumber(type.getLineLast()); exception.setLastColumnNumber(type.getColumnLast()); + } + // GRECLIPSE end list.add(exception); AST next = node.getNextSibling(); if (next != null) throwsList(next, list); diff --git a/ide-test/org.codehaus.groovy.eclipse.tests/src/org/codehaus/groovy/eclipse/test/ui/SemanticHighlightingTests.groovy b/ide-test/org.codehaus.groovy.eclipse.tests/src/org/codehaus/groovy/eclipse/test/ui/SemanticHighlightingTests.groovy index d5327cbc49..376fdbae63 100644 --- a/ide-test/org.codehaus.groovy.eclipse.tests/src/org/codehaus/groovy/eclipse/test/ui/SemanticHighlightingTests.groovy +++ b/ide-test/org.codehaus.groovy.eclipse.tests/src/org/codehaus/groovy/eclipse/test/ui/SemanticHighlightingTests.groovy @@ -5268,6 +5268,19 @@ final class SemanticHighlightingTests extends GroovyEclipseTestSuite { new HighlightedTypedPosition(contents.indexOf('String'), 6, CLASS)) } + @Test // https://github.com/groovy/groovy-eclipse/issues/1603 + void testQualifiedType9() { + String contents = '''\ + |def foo() throws java.lang.Exception , java.lang.Throwable { + |} + |'''.stripMargin() + + assertHighlighting(contents, + new HighlightedTypedPosition(contents.indexOf('foo'), 3, METHOD), + new HighlightedTypedPosition(contents.indexOf('Exception'), 9, CLASS), + new HighlightedTypedPosition(contents.indexOf('Throwable'), 9, CLASS)) + } + @Test void testSwitch1() { assumeTrue(isParrotParser() && isAtLeastGroovy(40))