cvs commit: jakarta-bcel/src/java/org/apache/bcel/verifier/statics Pass2Verifier.java

[email protected]
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <[email protected]>
enver       2004/10/08 02:30:13

  Modified:    src/java/org/apache/bcel/verifier/statics Pass2Verifier.java
  Log:
  Submitted by:	Rob Gonzales
  Reviewed by:	Enver Haase
  
  Don't reject a class "overriding" a "private final" method.
  
  Revision  Changes    Path
  1.8       +8 -3      jakarta-bcel/src/java/org/apache/bcel/verifier/statics/Pass2Verifier.java
  
  Index: Pass2Verifier.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/verifier/statics/Pass2Verifier.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Pass2Verifier.java	30 Apr 2004 06:51:33 -0000	1.7
  +++ Pass2Verifier.java	8 Oct 2004 09:30:13 -0000	1.8
  @@ -246,8 +246,13 @@
   				String name_and_sig = (methods[i].getName()+methods[i].getSignature());
   
   				if (hashmap.containsKey(name_and_sig)){
  -					if (methods[i].isFinal()){
  -						throw new ClassConstraintException("Method '"+name_and_sig+"' in class '"+hashmap.get(name_and_sig)+"' overrides the final (not-overridable) definition in class '"+jc.getClassName()+"'.");
  +					if ( methods[i].isFinal() ){
  +					  if (!(methods[i].isPrivate())) {
  +						  throw new ClassConstraintException("Method '"+name_and_sig+"' in class '"+hashmap.get(name_and_sig)+"' overrides the final (not-overridable) definition in class '"+jc.getClassName()+"'.");
  +					  }
  +					  else{
  +						  addMessage("Method '"+name_and_sig+"' in class '"+hashmap.get(name_and_sig)+"' overrides the final (not-overridable) definition in class '"+jc.getClassName()+"'. This is okay, as the original definition was private; however this constraint leverage was introduced by JLS 8.4.6 (not vmspec2) and the behaviour of the Sun verifiers.");
  +					  }
   					}
   					else{
   						if (!methods[i].isStatic()){ // static methods don't inherit
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.