KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jdo > api > persistence > enhancer > impl > Environment


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24
25 package com.sun.jdo.api.persistence.enhancer.impl;
26
27 import java.util.Hashtable JavaDoc;
28 import java.util.Iterator JavaDoc;
29 import java.util.HashMap JavaDoc;
30 import java.util.ArrayList JavaDoc;
31
32 import java.io.File JavaDoc;
33 //@olsen: added import
34
import java.io.PrintWriter JavaDoc;
35
36 import com.sun.jdo.api.persistence.enhancer.classfile.ClassFile;
37 import com.sun.jdo.api.persistence.enhancer.classfile.ClassField;
38
39 import com.sun.jdo.api.persistence.enhancer.util.ClassPath;
40 import com.sun.jdo.api.persistence.enhancer.util.ClassFileSource;
41 import com.sun.jdo.api.persistence.enhancer.util.Support;
42
43 //@olsen: added import
44
import com.sun.jdo.api.persistence.enhancer.meta.JDOMetaData;
45
46
47 //@lars added: field for last error message
48
//@olsen: cosmetics
49
//@olsen: moved: this class -> package impl
50
//@olsen: subst: /* ... */ -> // ...
51
//@olsen: make fields private
52
//@olsen: subst: FilterEnv -> Environment
53
//@olsen: subst: collectAllClasses -> collectClasses
54
//@olsen: subst: Vector -> Collection, ArrayList
55
//@olsen: subst: Enumeration,... -> Iterator, hasNext(), next()
56
//@olsen: subst: control -> cc
57
//@olsen: added: support for I18N
58
//@olsen: subst: FilterError -> UserException, assert()
59
//@olsen: removed: proprietary support for HashCode
60
//@olsen: removed: proprietary support for TypeSummary
61
//@olsen: removed: proprietary support for ClassInfo
62
//@olsen: removed: proprietary support for IndexableField
63
//@olsen: removed: support for IgnoreTransientField, AddedTransientField
64
//@olsen: removed: support for [No]AnnotateField
65
//@olsen: removed: old, disabled ODI code
66

67 //^olsen: move: ClassControl+ClassPath handling
68

69
70 /**
71  * Environment serves as a central collection for the options and
72  * working environment of the filter tool.
73  */

74 public final class Environment
75     extends Support {
76
77     /* Writer for regular program output and warnings. */
78     //@olsen: added field
79
private PrintWriter JavaDoc out = new PrintWriter JavaDoc(System.out, true);
80
81     /* Writer for error output. */
82     //@olsen: added field
83
private PrintWriter JavaDoc err = new PrintWriter JavaDoc(System.err, true);
84
85     /* If true, provide timing statistics */
86     //@olsen: added support for timing statistics
87
private boolean timingOption = false;
88
89     /* If true, provide verbose output */
90     private boolean verboseOption = false;
91
92     /* If true, squash warnings */
93     private boolean quietOption = false;
94
95     /* The level of debugging detail to provide - not currently used */
96 //@olsen: disabled feature
97
/*
98     private int dumpLevel = 0;
99 */

100
101     /* If true, perform only a dry run - no output is written to disk */
102     private boolean noWriteOption = false;
103
104     /* If true, allow java classes to be modified for persistence */
105 //@olsen: disabled feature
106
/*
107     private boolean modifyJavaClassesOption = false;
108 */

109
110     /* If true, allow final fields to be updated by initializeContents */
111 //@olsen: disabled feature
112
/*
113     private boolean allowFinalFieldModifications = false;
114 */

115
116     /* If true, disable hoisting of dirty(this), fetch(this) to the start
117        of a method */

118     private boolean disableThisHookHoisting;
119
120     /* If true, disable suppression of constructor annotation */
121     private boolean disableInitializerAnnotationSuppression;
122
123     /* If true, disable in-loop array caching */
124 //@olsen: disabled feature
125
/*
126     private boolean disableArrayHookCaching;
127 */

128
129     /* If true, disable element type-specific array fetching */
130     /* This knob is temporary */
131 //@olsen: disabled feature
132
/*
133     private boolean disableArrayElementFetch = false;
134 */

135
136     /* If true, forces overwriting all output files. */
137     private boolean forceOverwriteOption = false;
138
139     /* If true, perform class file updates in-place rather than to the
140        destination directory. */

141     private boolean updateInPlaceOption = false;
142
143     /* The number of errors encountered thus far */
144     private int errorsEncountered = 0;
145
146     /* The out directory specified */
147     private File JavaDoc destinationDirectory = null;
148
149     /* Hash VM class name to ClassControl */
150     private Hashtable JavaDoc classMap = new Hashtable JavaDoc(11);
151
152     /* Set of classes that were looked up but not found. */
153     //@olsen: subst: Hashtable -> HashMap
154
private HashMap JavaDoc missingClasses = new HashMap JavaDoc(11);
155
156     /* Hash VM class name to ClassControl
157      * Entries in this table have been renamed and the class control
158      * reflects the updated name */

159 //@olsen: inlined method
160
/*
161     private Hashtable renamedMap = new Hashtable(203);
162 */

163
164     /* explicit package name translations
165      * Maps string to string */

166 //@olsen: disabled feature
167
/*
168     private Hashtable translations = new Hashtable(11);
169 */

170
171     /* Search path to be used for locating classes */
172     //@olsen: added default initialization
173
private ClassPath classPathOption = new ClassPath("");//NOI18N
174

175     /* Search path to be used for locating annotated classes in output dir */
176     private ClassPath destClassPath;
177
178     /* A set of fully qualified field names (maps name to itself) */
179     private Hashtable JavaDoc fieldSuppressions = new Hashtable JavaDoc();
180
181     /* A set of fully qualified class names (maps name to itself) */
182     private Hashtable JavaDoc classSuppressions = new Hashtable JavaDoc();
183
184     /* The instance providing the JDO meta data. */
185     //@olsen: added field
186
private JDOMetaData jdoMetaData;
187
188     /* Last error message */
189     private String JavaDoc lastErrorMessage = null;
190
191     // public accessors
192

193     public void setDoTimingStatistics(boolean dontOpt) {
194         timingOption = dontOpt;
195     }
196
197     public boolean doTimingStatistics() {
198         return timingOption;
199     }
200
201     //@olsen: subst: param err -> error
202
public void error(String JavaDoc error) {
203         errorsEncountered++;
204         //@olsen: support for I18N
205
//@olsen: redirected output
206
//System.out.print("Error: ");
207
//System.out.println(err);
208
err.println(lastErrorMessage = getI18N("enhancer.enumerated_error",
209                                                errorsEncountered,
210                                                error));
211     }
212
213     public void warning(String JavaDoc warn) {
214         if (!quietOption) {
215             //@olsen: support for I18N
216
//@olsen: redirected output
217
//System.out.print("Warning: ");
218
//System.out.println(warn);
219
out.println(getI18N("enhancer.warning", warn));//NOI18N
220
}
221     }
222
223     public void warning(String JavaDoc warn, String JavaDoc classname) {
224         if (!quietOption &&
225             !classWarningsSuppressed(classname)) {
226             //@olsen: support for I18N
227
//@olsen: redirected output
228
//System.out.print("Warning: ");
229
//System.out.println(warn);
230
out.println(getI18N("enhancer.warning", warn));//NOI18N
231
}
232     }
233
234     public void warning(String JavaDoc warn, String JavaDoc classname, String JavaDoc fieldname) {
235         if (!quietOption &&
236             !classWarningsSuppressed(classname) &&
237             !fieldWarningsSuppressed(classname, fieldname)) {
238             //@olsen: support for I18N
239
//@olsen: redirected output
240
//System.out.print("Warning: ");
241
//System.out.println(warn);
242
out.print(getI18N("enhancer.warning", warn));//NOI18N
243
}
244     }
245
246     public void message(String JavaDoc mess) {
247         if (verboseOption) {
248             //@olsen: redirected output
249
//System.out.println(mess);
250
out.println("JDO ENHANCER: " + mess);//NOI18N
251
}
252     }
253
254     public void messageNL(String JavaDoc mess) {
255         if (verboseOption) {
256             //@olsen: redirected output
257
//System.out.println(mess);
258
out.println();
259             out.println("JDO ENHANCER: " + mess);//NOI18N
260
}
261     }
262
263     public int errorCount() {
264         return errorsEncountered;
265     }
266
267     public final String JavaDoc getLastErrorMessage () {
268         return this.lastErrorMessage;
269     }
270
271 //@olsen: disabled feature
272
/*
273     public boolean verbose() {
274         return verboseOption;
275     }
276
277     public boolean quiet() {
278         return quietOption;
279     }
280 */

281
282     public boolean forceOverwrite() {
283         return forceOverwriteOption;
284     }
285
286     public boolean updateInPlace() {
287         return updateInPlaceOption;
288     }
289
290     //@olsen: added method
291
public File JavaDoc destinationDirectory() {
292         return destinationDirectory;
293     }
294
295 //@olsen: disabled feature
296
/*
297     //@olsen: added method
298     public Hashtable translations() {
299         return translations;
300     }
301 */

302
303     //@olsen: added method
304
//@olsen: disabled feature
305
/*
306     public ClassPath classPathOption() {
307         return classPathOption;
308     }
309 */

310
311     /**
312      * Expected dump levels are 0, 1, 2, 3
313      * dump level 0 is always on.
314      */

315 //@olsen: disabled feature
316
/*
317     public boolean dump(int level) {
318         return dumpLevel >= level;
319     }
320 */

321
322     public boolean writeClasses() {
323         return (noWriteOption == false && errorsEncountered == 0);
324     }
325
326 //@olsen: disabled feature
327
/*
328     public boolean doArrayOptimization() {
329         return disableArrayHookCaching == false;
330     }
331 */

332
333     public boolean doThisOptimization() {
334         return disableThisHookHoisting == false;
335     }
336
337 //@olsen: disabled feature
338
/*
339     public boolean doArrayElementFetch() {
340         return disableArrayElementFetch == false;
341     }
342 */

343
344     public boolean doInitializerOptimization() {
345         return disableInitializerAnnotationSuppression == false;
346     }
347
348 //@olsen: disabled feature
349
/*
350     public boolean modifyJavaClasses() {
351         return modifyJavaClassesOption;
352     }
353 */

354
355 //@olsen: disabled feature
356
/*
357     public boolean allowFinalModifications() {
358         return allowFinalFieldModifications;
359     }
360 */

361
362     /**
363      * Is the class a well known persistent capable class? These are
364      * normally the java primitives.
365      */

366     //@olsen: subst: isKnownPersistent -> JDOMetaData.isSecondClassObjectType
367
/*
368     public boolean isKnownPersistent(String className) {
369         if (className.equals("java/lang/String") ||
370             className.equals("java/lang/Integer") ||
371             className.equals("java/lang/Number") ||
372             className.equals("java/lang/Short") ||
373             className.equals("java/lang/Byte") ||
374             className.equals("java/lang/Long") ||
375             className.equals("java/lang/Float") ||
376             className.equals("java/lang/Double") ||
377             className.equals("java/lang/Character") ||
378             className.equals("java/lang/Boolean"))
379             return true;
380         return false;
381     }
382 */

383
384     /* The instance providing the JDO meta data. */
385     //@olsen: added method
386
public JDOMetaData getJDOMetaData()
387     {
388         return jdoMetaData;
389     }
390
391     /* Set the instance providing the JDO meta data. */
392     //@olsen: added method
393
public void setJDOMetaData(JDOMetaData jdoMetaData)
394     {
395         this.jdoMetaData = jdoMetaData;
396     }
397
398     /**
399      * Add a newly created transient class to the list of classes.
400      * Its source should be "near" friend. That is, if the friend
401      * is in a zip file, place this in the same zip file. Else if it
402      * is in an individual class file, place this in a class file in
403      * the same directory.
404      */

405 //@olsen: disabled feature
406
/*
407     public ClassControl addClass(ClassFile newClass, ClassFileSource friend) {
408         String className = newClass.className().asString();
409         ClassFileSource source = friend.friendSource(className);
410         ClassControl cc = new ClassControl(source, newClass, this);
411         cc.noteUpdate();
412         cc.setPersistType(ClassControl.PersistUnknown);
413         classMap.put(className, cc);
414         return cc;
415     }
416 */

417
418     /**
419      * Add a newly created transient class to the list of classes.
420      * Its source is undefined.
421      */

422 //@olsen: disabled feature
423
/*
424     public ClassControl addClass(ClassFile newClass) {
425         String className = newClass.className().asString();
426         ClassFileSource source = new ClassFileSource(className, (File)null);
427         ClassControl cc = new ClassControl(source, newClass, this);
428         cc.noteUpdate();
429         cc.setPersistType(ClassControl.PersistUnknown);
430         classMap.put(className, cc);
431         return cc;
432     }
433 */

434
435     /**
436      * Add the class to the class mapping table. Check that it does
437      * not conflict with earlier settings.
438      */

439     //@olsen: moved: OSCFP.addClass(ClassControl) -> impl.Environment
440
public void addClass(ClassControl cc) {
441         String JavaDoc className = cc.className();
442         ClassControl existCC = getClass(className);
443
444         if (existCC != null) {
445
446             if (!existCC.source().sameAs(cc.source())) {
447                 //@olsen: support for I18N
448
error(getI18N("enhancer.class_already_entered",//NOI18N
449
cc.userClassName(),
450                               cc.sourceName(),
451                               existCC.sourceName()));
452                 return;
453             }
454
455             // the two files are from the same source - select the higher
456
// level of persistence capability and discard the other
457
if (cc.persistType() == ClassControl.PersistUnknown ||
458                 existCC.persistType() == ClassControl.PersistCapable ||
459                 (existCC.persistType() == ClassControl.PersistAware &&
460                  cc.persistType() != ClassControl.PersistCapable))
461                 return;
462
463         }
464
465         if (existCC == null && cc.sourceName() != null)
466             message("adding class " + cc.userClassName() +//NOI18N
467
" from " + cc.sourceName());//NOI18N
468

469         classMap.put(className, cc);
470     }
471
472     /**
473      * Add the modified name to the class map if the class name has changed.
474      */

475     //@olsen: added method
476
//@olsen: disabled feature
477
/*
478     public void renameClass(String oldClassName) {
479         ClassControl cc = (ClassControl)classMap.remove(oldClassName);
480         String newClassName = cc.className();
481         renamedMap.put(oldClassName, cc);
482         classMap.put(newClassName, cc);
483     }
484 */

485
486     /**
487      * Look for the specified class in the class map. If not there,
488      * use the class path to find the class. If still not found,
489      * return false.
490      */

491     public boolean canFindClass(String JavaDoc className) {
492         return findClass(className) != null;
493     }
494
495     /**
496      * Look for the specified class in the class map. No other class
497      * lookup is performed. Use this only if you are certain that the
498      * class will have been found.
499      */

500     public ClassControl getClass(String JavaDoc className) {
501         return (ClassControl)classMap.get(className);
502     }
503
504     //@olsen: added method
505
public Iterator JavaDoc getClasses() {
506         return classMap.values().iterator();
507     }
508
509     /**
510      * Look for the specified class in the class map. If not there,
511      * use the class path to find the class. If still not found,
512      * return false.
513      */

514     public ClassControl findClass(String JavaDoc className) {
515         ClassControl cc = (ClassControl) classMap.get(className);
516
517         if ((cc == null) && (missingClasses.get(className) == null)) {
518
519             // Not already known - try looking up in class path
520
cc = lookupClass(className);
521             if (cc != null) {
522                 message("Reading class " + cc.userClassName() +//NOI18N
523
" from " + cc.sourceName());//NOI18N
524
classMap.put(className, cc);
525             } else {
526                 missingClasses.put(className, className);
527             }
528         }
529
530         return cc;
531     }
532
533     /**
534      * Look up the specified class in the class search path. Callers
535      * should normally consult the classmap prior to calling this function.
536      * The class is not entered into the classmap
537      */

538     public ClassControl lookupClass(String JavaDoc className) {
539         ClassFileSource source = classPathOption.findClass(className);
540
541         while (true) {
542             if (source == null)
543                 return null;
544
545             //@olsen: cosmetics
546
try {
547                 ClassControl cc = new ClassControl(source, this);
548                 if (cc.className() != null &&
549                     cc.className().equals(className))
550                     return cc;
551             } catch (ClassFormatError JavaDoc e) {
552             }
553
554             // Try to find an alternate source for the class
555
source = source.nextSource(className);
556         }
557     }
558
559
560     /**
561      * Look for the specified class in the renamed class map.
562      * No classpath searching is done.
563      */

564 //@olsen: disabled feature
565
/*
566     public ClassControl getRenamedClass(String className) {
567         return (ClassControl) renamedMap.get(className);
568     }
569 */

570
571     /**
572      * Return a ArrayList of ClassControl objects which have the specified
573      * persistence type
574      */

575     public ArrayList JavaDoc collectClasses(int persistType) {
576         ArrayList JavaDoc v = new ArrayList JavaDoc();
577         for (Iterator JavaDoc e = classMap.values().iterator(); e.hasNext();) {
578             ClassControl cc = (ClassControl)e.next();
579             if (cc.persistType() == persistType)
580                 v.add(cc);
581         }
582         return v;
583     }
584
585     /**
586      * Return an ArrayList of the ClassControls in classMap.
587      * This is useful in that it provides a stable base for enumeration.
588      */

589     public ArrayList JavaDoc collectClasses() {
590         ArrayList JavaDoc v = new ArrayList JavaDoc();
591         for (Iterator JavaDoc e = classMap.values().iterator(); e.hasNext(); )
592             v.add(e.next());
593         return v;
594     }
595
596
597     /**
598      * Look for a class source using the destination directory as a
599      * root directory for the lookup which represents the annotated output
600      * for the class specified. Return null if not found.
601      */

602     public ClassFileSource lookupDestClass(String JavaDoc className) {
603         if (destClassPath == null && destinationDirectory != null)
604             destClassPath = new ClassPath(destinationDirectory.getPath());
605         return (destClassPath == null
606                 ? null : destClassPath.findClass(className));
607     }
608
609     // package local methods
610

611
612     /**
613      * The constructor
614      */

615     public Environment() {
616     }
617
618 //@olsen: disabled feature
619
/*
620     public void setClassPath(String path) {
621         message("setting class path to " + path);
622         classPathOption = new ClassPath(path);
623     }
624 */

625
626     public void setDestinationDirectory(String JavaDoc dir) {
627         final File JavaDoc dest = new File JavaDoc(dir);
628         if (destinationDirectory != null) {
629             //@olsen: support for I18N
630
error(getI18N("destination_directory_already_set",//NOI18N
631
dir,
632                           destinationDirectory.getPath()));
633             return;
634         }
635         if (!dest.isDirectory()) {
636             error(getI18N("enhancer.destination_directory_not_exist",//NOI18N
637
dir));
638             return;
639         }
640         destinationDirectory = dest;
641     }
642
643     /**
644      * Update the class path to remove the destination directory if it
645      * is found in the class path.
646      */

647     public void excludeDestinationDirectory() {
648         if (destinationDirectory != null)
649             classPathOption.remove(destinationDirectory);
650     }
651
652     /**
653      * Update the class path to move the destination directory to the
654      * end of the class path if it is found in the class path.
655      */

656     public void moveDestinationDirectoryToEnd() {
657         if (destinationDirectory != null &&
658             classPathOption.remove(destinationDirectory))
659             classPathOption.append(destinationDirectory);
660     }
661
662     //@olsen: added method
663
public void setOutputWriter(PrintWriter JavaDoc out) {
664         this.out = out;
665     }
666
667     //@olsen: added method
668
public PrintWriter JavaDoc getOutputWriter() {
669         return out;
670     }
671
672     //@olsen: added method
673
public void setErrorWriter(PrintWriter JavaDoc err) {
674         this.err = err;
675     }
676
677     //@olsen: added method
678
public PrintWriter JavaDoc getErrorWriter() {
679         return err;
680     }
681
682     public void setVerbose(boolean beVerbose) {
683         verboseOption = beVerbose;
684     }
685
686     public boolean isVerbose() {
687         return this.verboseOption;
688     }
689
690     public void setQuiet(boolean beQuiet) {
691         quietOption = beQuiet;
692     }
693
694 //@olsen: disabled feature
695
/*
696     public void setModifyJavaClasses(boolean allowMods) {
697         modifyJavaClassesOption = allowMods;
698     }
699 */

700
701 //@olsen: disabled feature
702
/*
703     public void setAllowFinalModifications(boolean allowMods) {
704         allowFinalFieldModifications = allowMods;
705     }
706 */

707
708     public void setNoWrite(boolean dontWrite) {
709         noWriteOption = dontWrite;
710     }
711
712     // optimization control
713

714 //@olsen: disabled feature
715
/*
716     public void setNoArrayOptimization(boolean dontOpt) {
717         disableArrayHookCaching = dontOpt;
718         disableArrayElementFetch = dontOpt;
719     }
720 */

721
722     public void setNoThisOptimization(boolean dontOpt) {
723         disableThisHookHoisting = dontOpt;
724     }
725
726     public void setNoInitializerOptimization(boolean dontOpt) {
727         disableInitializerAnnotationSuppression = dontOpt;
728     }
729
730     public void setNoOptimization(boolean dontOpt) {
731 //@olsen: disabled feature
732
/*
733         disableArrayHookCaching = dontOpt;
734 */

735         disableThisHookHoisting = dontOpt;
736         disableInitializerAnnotationSuppression = dontOpt;
737 //@olsen: disabled feature
738
/*
739         disableArrayElementFetch = dontOpt;
740 */

741     }
742
743     public void setForceOverwrite(boolean forceOverwrite) {
744         forceOverwriteOption = forceOverwrite;
745     }
746
747 //@olsen: disabled feature
748
/*
749     public void setUpdateInPlace(boolean inPlace) {
750         updateInPlaceOption = inPlace;
751     }
752 */

753
754 //@olsen: disabled feature
755
/*
756     public void setPackageTranslation(String origPackage, String newPackage) {
757         // make special allowances for unpackaged classes
758         if (origPackage.equals("."))
759             origPackage = "";
760         if (newPackage.equals("."))
761             newPackage = "";
762
763         String validOrigPackage = validVMPackage(origPackage);
764         String validNewPackage = validVMPackage(newPackage);
765
766         if (validOrigPackage == null)
767             error("The name \"" + origPackage + "\" is not a valid package name.");
768         else if (validNewPackage == null)
769             error("The name \"" + newPackage + "\" is not a valid package name.");
770
771         translations.put(validOrigPackage, validNewPackage);
772     }
773 */

774
775     /**
776      * Add a suppression entry for a class
777      */

778     public void suppressClassWarnings(String JavaDoc className) {
779         classSuppressions.put(className, className);
780     }
781
782     /**
783      * Add a suppression entry for a field of a class
784      */

785     public void suppressFieldWarnings(String JavaDoc fullFieldName) {
786         fieldSuppressions.put(fullFieldName, fullFieldName);
787     }
788
789     /**
790      * Convert a user package name to a VM package name.
791      * If the package name isn't valid, return null instead.
792      */

793     static String JavaDoc validVMPackage(String JavaDoc pkg) {
794         StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
795
796         int i=0;
797         while (i<pkg.length()) {
798             if (i != 0) {
799                 // each package component must be preceded by a '.'
800
if (pkg.charAt(i) != '.')
801                     return null;
802
803                 // translate '.' to '/'
804
buf.append("/");//NOI18N
805

806                 // there must be more characters for the next package component
807
i++;
808                 if (i == pkg.length())
809                     return null;
810             }
811
812             if (!Character.isJavaIdentifierStart(pkg.charAt(i)))
813                 return null;
814             buf.append(pkg.charAt(i++));
815
816             while (i < pkg.length() &&
817                    Character.isJavaIdentifierPart(pkg.charAt(i)))
818                 buf.append(pkg.charAt(i++));
819         }
820
821         return buf.toString();
822     }
823
824     /**
825      * Check whether the named class should have warnings suppressed.
826      */

827     private boolean classWarningsSuppressed(String JavaDoc classname) {
828         return classSuppressions.get(classname) != null;
829     }
830
831     /**
832      * Check whether the named field in the named class should have
833      * warnings suppressed.
834      */

835     private boolean fieldWarningsSuppressed(String JavaDoc classname,
836                                             String JavaDoc fieldName) {
837         return fieldSuppressions.get(classname + "." + fieldName) != null;//NOI18N
838
}
839
840     /**
841      * Reset the environment.
842      */

843     //@olsen: added method
844
public void reset() {
845 /*
846         jdoMetaData = null;
847
848         verboseOption = false;
849         quietOption = false;
850         dumpLevel = 0;
851
852         disableThisHookHoisting = false;
853         disableInitializerAnnotationSuppression = false;
854         disableArrayHookCaching = false;
855         disableArrayElementFetch = false;
856
857         noWriteOption = false;
858         forceOverwriteOption = false;
859         updateInPlaceOption = false;
860         classPathOption = null;
861         destinationDirectory = null;
862         destClassPath = null;
863
864         renamedMap.clear();
865         translations.clear();
866 */

867         errorsEncountered = 0;
868
869         classMap.clear();
870         missingClasses.clear();
871
872         fieldSuppressions.clear();
873         classSuppressions.clear();
874     }
875 }
876
Popular Tags