You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2020/07/18 17:27:00 UTC
[jira] [Assigned] (GROOVY-5103) groovy compiler ignores import *
for static nested classes in java sources
[ https://issues.apache.org/jira/browse/GROOVY-5103?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles reassigned GROOVY-5103:
-----------------------------------
Assignee: Eric Milles
> groovy compiler ignores import * for static nested classes in java sources
> --------------------------------------------------------------------------
>
> Key: GROOVY-5103
> URL: https://issues.apache.org/jira/browse/GROOVY-5103
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 1.8.3
> Reporter: Dave Clark
> Assignee: Eric Milles
> Priority: Minor
>
> (using Groovy 1.8.3, JVM 1.6.0_23 OpenJDK)
> Given this class:
> {code:title=Foo.java}
> package org.test;
> public class Foo {
> public static class Bar {
> String message;
>
> public Bar(String message) {
> this.message = message;
> }
> }
> public static class Cat {
> Integer amount;
> public Cat(Integer amount) {
> this.amount = amount;
> }
> }
> }
> {code}
> Groovy code can import both of these static nested classes like this:
> {code}
> import static org.test.Foo.*
> {code}
> However, in Java they are imported like this:
> {code}
> import org.test.Foo.*;
> {code}
> Using the Groovy compiler to compile any Java files which do the above will result in the following error if any of the static nested classes are used:
> {code}
> App.java: 9: unable to resolve class Bar
> @ line 9, column 13.
> Bar bar = new Bar("Hello");
> {code}
> Is this expected? If so, is there a known workaround (or maybe I'm just doing it wrong...)?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)