You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Thodoris Sotiropoulos (Jira)" <ji...@apache.org> on 2023/01/26 15:33:00 UTC
[jira] [Created] (GROOVY-10917) Inconsistency when accessing protected fields
Thodoris Sotiropoulos created GROOVY-10917:
----------------------------------------------
Summary: Inconsistency when accessing protected fields
Key: GROOVY-10917
URL: https://issues.apache.org/jira/browse/GROOVY-10917
Project: Groovy
Issue Type: Bug
Components: Static Type Checker
Reporter: Thodoris Sotiropoulos
I have the following program
{code}
import java.util.*;
import java.io.*;
class Main {
static public final void main(String[] args) throws Exception {
Object x = new EventObject(null).source;
int pos = new PushbackInputStream(null).pos;
}
}
{code}
h3. Actual behavior
{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
test.groovy: 7: Access to java.io.PushbackInputStream#pos is forbidden @ line 7, column 15.
int pos = new PushbackInputStream(null).pos
^
1 error
{code}
h3. Expected behavior
Report errors for both field accesses since "pos" and "source" are protected fields.
See https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/EventObject.html
Tested against master (commit: 5a5726342adeb37a6fbaa8cdcbe2d47dee8dc56c)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)