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 2023/02/04 03:17:00 UTC
[jira] [Closed] (GROOVY-10917) Inconsistency when accessing protected fields
[ https://issues.apache.org/jira/browse/GROOVY-10917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles closed GROOVY-10917.
--------------------------------
Resolution: Information Provided
> 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
> Priority: Major
>
> 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)