[ 
https://issues.apache.org/jira/browse/BVAL-106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13289992#comment-13289992
 ] 

Eric Charles commented on BVAL-106:
-----------------------------------

Hi Matt,

Good catch from the javabugs.

I have read 7022052, and I think it's a bug in JDK6 (JDK7 behaves correctly). 
Private fields/methods from base class are not accessible from extension (see 
sample code [1]).

So I think the proposed patch should be applied.
Thx, Eric

[1]

public class Extend extends Base {
    
    public String getField() {
        this.protectedMethod();
        // this.privateMethod() // No access to private methods.
        // this.privateField; // No access to private fields.
        return this.protectedField;
    }

}

class Base {
    protected String protectedField;
    private String privateField;
    
    protected void protectedMethod() {
    }

    private void privateMethod() {
    }

}
                
> Maven compilation fails on FeaturesCapable
> ------------------------------------------
>
>                 Key: BVAL-106
>                 URL: https://issues.apache.org/jira/browse/BVAL-106
>             Project: BVal
>          Issue Type: Bug
>          Components: build
>    Affects Versions: 0.5
>            Reporter: Eric Charles
>         Attachments: BVAL-106.patch
>
>
> I receive the following error when I invoke 'mvn install' current trunk (Last 
> Changed Rev: 1311512)
> [ERROR] 
> /d/bval.svn/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java:[148,14]
>  error: features has private access in FeaturesCapable
> [ERROR] 
> /d/bval.svn/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java:[149,14]
>  error: features has private access in FeaturesCapable
> [ERROR] 
> /d/bval.svn/bval-core/src/main/java/org/apache/bval/model/FeaturesCapable.java:[151,18]
>  error: validations has private access in FeaturesCapable
> [INFO] 3 errors 
> This occurs on Ubuntu with JDK7 and JDK6
> java -version
> java version "1.7.0_04-ea"
> Java(TM) SE Runtime Environment (build 1.7.0_04-ea-b17)
> Java HotSpot(TM) 64-Bit Server VM (build 23.0-b18, mixed mode)
> java -version
> java version "1.6.0_31"
> Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
> Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to