You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlbeans-cvs@xml.apache.org by pc...@apache.org on 2004/07/19 20:23:42 UTC

cvs commit: xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/provider JamClassBuilder.java JamServiceContext.java

pcal        2004/07/19 11:23:42

  Modified:    v2/jam/src/org/apache/xmlbeans/impl/jam
                        JamServiceParams.java
               v2/jam/src/org/apache/xmlbeans/impl/jam/internal
                        JamServiceContextImpl.java
               v2/jam/src/org/apache/xmlbeans/impl/jam/provider
                        JamClassBuilder.java JamServiceContext.java
  Log:
  better switch for suppressing 14 warnings
  
  Revision  Changes    Path
  1.14      +8 -0      xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/JamServiceParams.java
  
  Index: JamServiceParams.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/JamServiceParams.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- JamServiceParams.java	28 Jun 2004 21:11:00 -0000	1.13
  +++ JamServiceParams.java	19 Jul 2004 18:23:42 -0000	1.14
  @@ -326,9 +326,17 @@
     public void setProperty(String name, String value);
   
     /**
  +   * <p>Sets whether warnings should be displayed when running under
  +   * JDK 1.4.  The default is true.</p>
  +   */ 
  +  public void set14WarningsEnabled(boolean b);
  +
  +  /**
      * @deprecated use setVerbose(Class).  This is the same as
      * setVerbose(Object.class).
      */
     public void setVerbose(boolean v);
  +
  +
   
   }
  
  
  
  1.19      +9 -0      xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/JamServiceContextImpl.java
  
  Index: JamServiceContextImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/JamServiceContextImpl.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- JamServiceContextImpl.java	28 Jun 2004 21:11:00 -0000	1.18
  +++ JamServiceContextImpl.java	19 Jul 2004 18:23:42 -0000	1.19
  @@ -55,6 +55,7 @@
     // ========================================================================
     // Variables
   
  +  private boolean m14WarningsEnabled = false;
     private Class mDefaultAnnotationProxyClass = null;
     private Properties mProperties = null;
     private Map mSourceRoot2Scanner = null;
  @@ -110,6 +111,7 @@
       return mTagParser;
     }
   
  +
     // ========================================================================
     // Constructors
   
  @@ -398,6 +400,11 @@
       mProperties.setProperty(name,value);
     }
   
  +  public void set14WarningsEnabled(boolean b) {
  +    m14WarningsEnabled = b;
  +  }
  +
  +
     //public void setLogger(PrintWriter out) { mOut = out; }
   
   
  @@ -443,6 +450,8 @@
         return out;
       }
     }
  +
  +  public boolean is14WarningsEnabled() { return m14WarningsEnabled; }
   
     // ========================================================================
     // ElementContext implementation
  
  
  
  1.16      +15 -5     xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/provider/JamClassBuilder.java
  
  Index: JamClassBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/provider/JamClassBuilder.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- JamClassBuilder.java	19 Jul 2004 17:24:59 -0000	1.15
  +++ JamClassBuilder.java	19 Jul 2004 18:23:42 -0000	1.16
  @@ -32,7 +32,7 @@
     // Variables
   
     private ElementContext mContext = null;
  -  public static boolean mWarningAlreadyIssued = false;
  +  private boolean m14WarningDone = false;
   
     // ========================================================================
     // Public methods
  @@ -150,12 +150,13 @@
      */
     protected void issue14BuildWarning(Throwable t) {
       assertInitialized();
  -    if (!mWarningAlreadyIssued && mContext != null) {
  +
  +    if (do14Warning()) {
         mContext.warning("This build of JAM was not with JDK 1.5." +
                         "Even though you are now running under JDK 1.5, "+
                         "JSR175-style annotations will not be available");
         if (mContext.isVerbose(this)) mContext.verbose(t);
  -      mWarningAlreadyIssued = true;
  +      m14WarningDone = true;
       }
     }
   
  @@ -165,12 +166,21 @@
      */
     protected void issue14RuntimeWarning(Throwable t) {
       assertInitialized();
  -    if (!mWarningAlreadyIssued && mContext != null) {
  +    if (do14Warning()) {
         mContext.warning("You are running under a pre-1.5 JDK.  JSR175-style "+
                         "source annotations will not be available");
         if (mContext.isVerbose(this)) mContext.verbose(t);
  -      mWarningAlreadyIssued = true;
  +      m14WarningDone = true;
       }
  +  }
  +
  +  // ========================================================================
  +  // Private methods
  +
  +  private boolean do14Warning() {
  +    if (m14WarningDone) return false;
  +    return (mContext == null) ? true :
  +      ((JamServiceContext)mContext).is14WarningsEnabled();
     }
   
   }
  
  
  
  1.10      +2 -0      xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/provider/JamServiceContext.java
  
  Index: JamServiceContext.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/provider/JamServiceContext.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JamServiceContext.java	28 May 2004 17:02:52 -0000	1.9
  +++ JamServiceContext.java	19 Jul 2004 18:23:42 -0000	1.10
  @@ -128,6 +128,8 @@
   
     //public PrintWriter getOut();
   
  +  public boolean is14WarningsEnabled();
  +
   
     // ========================================================================
     // killme
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org