[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-core-libs-dev
Subject:    Re: RFR: JDK-8315458 Implement JEP 463: Implicitly Declared Classes and Instance Main Method (Second
From:       Maurizio Cimadamore <mcimadamore () openjdk ! org>
Date:       2023-11-20 11:58:48
Message-ID: nhftRPjOyMdisGmXpnuXSdZk8WmpOl_Eaa1o0JIeq2Y=.7231a9eb-ec81-4dcb-984a-78b032294c8c () github ! com
[Download RAW message or body]

On Mon, 20 Nov 2023 11:53:35 GMT, Maurizio Cimadamore <mcimadamore@openjdk.org> \
wrote:

> > Jim Laskey has updated the pull request incrementally with one additional commit \
> > since the last revision: 
> > Allow nested class of same name as file
> > 
> > Since it doesn't create a conflicting symbol and would produce a confusing error \
> > otherwise.
> 
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java line 464:
> 
> > 462:         }
> > 463:         for (Symbol sym = s.owner; sym != null; sym = sym.owner) {
> > 464:             if (sym.kind == TYP && sym.name == name && sym.name != \
> > names.error &&
> 
> Looks good!

I recommend adding a test for this (if not already done) - checking cases like:

// A.java
void m() { }
class A {}


but also where A is nested deeper:


// A.java
void m() { }
class B {
   class A { }
}


And then also check that the test still works for other classes defined in the \
implicit unit:


// A.java
void m() { }
class B {
   class B { } //error
}

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16461#discussion_r1399096324


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic