src/java.base/share/classes/jdk/internal/org/objectweb/asm/commons/SerialVersionUIDAdder.java

Print this page




 349 
 350         super.visitEnd();
 351     }
 352 
 353     // ------------------------------------------------------------------------
 354     // Utility methods
 355     // ------------------------------------------------------------------------
 356 
 357     /**
 358      * Returns true if the class already has a SVUID field. The result of this
 359      * method is only valid when visitEnd is or has been called.
 360      *
 361      * @return true if the class already has a SVUID field.
 362      */
 363     public boolean hasSVUID() {
 364         return hasSVUID;
 365     }
 366 
 367     protected void addSVUID(long svuid) {
 368         FieldVisitor fv = super.visitField(Opcodes.ACC_FINAL
 369                 + Opcodes.ACC_STATIC, "serialVersionUID", "J", null, new Long(
 370                 svuid));
 371         if (fv != null) {
 372             fv.visitEnd();
 373         }
 374     }
 375 
 376     /**
 377      * Computes and returns the value of SVUID.
 378      *
 379      * @return Returns the serial version UID
 380      * @throws IOException
 381      *             if an I/O error occurs
 382      */
 383     protected long computeSVUID() throws IOException {
 384         ByteArrayOutputStream bos;
 385         DataOutputStream dos = null;
 386         long svuid = 0;
 387 
 388         try {
 389             bos = new ByteArrayOutputStream();
 390             dos = new DataOutputStream(bos);




 349 
 350         super.visitEnd();
 351     }
 352 
 353     // ------------------------------------------------------------------------
 354     // Utility methods
 355     // ------------------------------------------------------------------------
 356 
 357     /**
 358      * Returns true if the class already has a SVUID field. The result of this
 359      * method is only valid when visitEnd is or has been called.
 360      *
 361      * @return true if the class already has a SVUID field.
 362      */
 363     public boolean hasSVUID() {
 364         return hasSVUID;
 365     }
 366 
 367     protected void addSVUID(long svuid) {
 368         FieldVisitor fv = super.visitField(Opcodes.ACC_FINAL
 369                 + Opcodes.ACC_STATIC, "serialVersionUID", "J", null, svuid);

 370         if (fv != null) {
 371             fv.visitEnd();
 372         }
 373     }
 374 
 375     /**
 376      * Computes and returns the value of SVUID.
 377      *
 378      * @return Returns the serial version UID
 379      * @throws IOException
 380      *             if an I/O error occurs
 381      */
 382     protected long computeSVUID() throws IOException {
 383         ByteArrayOutputStream bos;
 384         DataOutputStream dos = null;
 385         long svuid = 0;
 386 
 387         try {
 388             bos = new ByteArrayOutputStream();
 389             dos = new DataOutputStream(bos);