experiments/JavaCompilerProblemRegistry.st
branchdevelopment
changeset 2645 b7a540a27521
child 2711 a00302fe5083
equal deleted inserted replaced
2644:e61250315ca8 2645:b7a540a27521
       
     1 "
       
     2  Copyright (c) 2010-2011 Jan Vrany, Jan Kurs & Marcel Hlopko,
       
     3                          SWING Research Group, Czech Technical University 
       
     4                          in Prague
       
     5 
       
     6  Permission is hereby granted, free of charge, to any person
       
     7  obtaining a copy of this software and associated documentation
       
     8  files (the 'Software'), to deal in the Software without
       
     9  restriction, including without limitation the rights to use,
       
    10  copy, modify, merge, publish, distribute, sublicense, and/or sell
       
    11  copies of the Software, and to permit persons to whom the
       
    12  Software is furnished to do so, subject to the following
       
    13  conditions:
       
    14 
       
    15  The above copyright notice and this permission notice shall be
       
    16  included in all copies or substantial portions of the Software.
       
    17 
       
    18  THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
       
    19  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
       
    20  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
       
    21  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
       
    22  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
       
    23  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
       
    24  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
       
    25  OTHER DEALINGS IN THE SOFTWARE.
       
    26 "
       
    27 "{ Package: 'stx:libjava/experiments' }"
       
    28 
       
    29 Object subclass:#JavaCompilerProblemRegistry
       
    30 	instanceVariableNames:'problems'
       
    31 	classVariableNames:''
       
    32 	poolDictionaries:''
       
    33 	category:'Languages-Java-Support-Compiling'
       
    34 !
       
    35 
       
    36 JavaCompilerProblemRegistry class instanceVariableNames:'theOneAndOnlyInstance'
       
    37 
       
    38 "
       
    39  No other class instance variables are inherited by this class.
       
    40 "
       
    41 !
       
    42 
       
    43 !JavaCompilerProblemRegistry class methodsFor:'documentation'!
       
    44 
       
    45 copyright
       
    46 "
       
    47  Copyright (c) 2010-2011 Jan Vrany, Jan Kurs & Marcel Hlopko,
       
    48                          SWING Research Group, Czech Technical University 
       
    49                          in Prague
       
    50 
       
    51  Permission is hereby granted, free of charge, to any person
       
    52  obtaining a copy of this software and associated documentation
       
    53  files (the 'Software'), to deal in the Software without
       
    54  restriction, including without limitation the rights to use,
       
    55  copy, modify, merge, publish, distribute, sublicense, and/or sell
       
    56  copies of the Software, and to permit persons to whom the
       
    57  Software is furnished to do so, subject to the following
       
    58  conditions:
       
    59 
       
    60  The above copyright notice and this permission notice shall be
       
    61  included in all copies or substantial portions of the Software.
       
    62 
       
    63  THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
       
    64  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
       
    65  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
       
    66  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
       
    67  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
       
    68  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
       
    69  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
       
    70  OTHER DEALINGS IN THE SOFTWARE.
       
    71 
       
    72 "
       
    73 ! !
       
    74 
       
    75 !JavaCompilerProblemRegistry class methodsFor:'instance creation'!
       
    76 
       
    77 flush
       
    78     "flushes the cached singleton"
       
    79 
       
    80     theOneAndOnlyInstance := nil
       
    81 
       
    82     "
       
    83      self flushSingleton
       
    84     "
       
    85 
       
    86     "Created: / 06-08-2013 / 10:19:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    87 !
       
    88 
       
    89 instance
       
    90     "returns a singleton"
       
    91 
       
    92     theOneAndOnlyInstance isNil ifTrue:[
       
    93         theOneAndOnlyInstance := self basicNew initialize.
       
    94     ].
       
    95     ^ theOneAndOnlyInstance.
       
    96 
       
    97     "Created: / 06-08-2013 / 10:19:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    98 !
       
    99 
       
   100 new
       
   101     "returns a singleton"
       
   102 
       
   103     ^ self instance.
       
   104 
       
   105     "Modified: / 06-08-2013 / 10:20:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   106 ! !
       
   107 
       
   108 !JavaCompilerProblemRegistry class methodsFor:'accessing'!
       
   109 
       
   110 problemsFor: jclass
       
   111     ^ self instance problemsFor: jclass.
       
   112 
       
   113     "Created: / 06-08-2013 / 10:29:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   114 !
       
   115 
       
   116 problemsFor: jclass put: problems
       
   117     ^ self instance problemsFor: jclass put: problems
       
   118 
       
   119     "Created: / 06-08-2013 / 10:29:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   120 ! !
       
   121 
       
   122 !JavaCompilerProblemRegistry methodsFor:'accessing'!
       
   123 
       
   124 problemsFor: jclass
       
   125     ^ problems at: jclass ifAbsent:[nil]
       
   126 
       
   127     "Created: / 06-08-2013 / 10:24:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   128 !
       
   129 
       
   130 problemsFor: jclass put: problemsForClass
       
   131     problemsForClass isNil ifTrue:[
       
   132         problems removeKey: jclass ifAbsent:[nil].
       
   133     ] ifFalse:[
       
   134         problems at: jclass put: problemsForClass.
       
   135     ].
       
   136     self changed: #problems with: jclass.
       
   137 
       
   138     "Created: / 06-08-2013 / 10:25:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   139 ! !
       
   140 
       
   141 !JavaCompilerProblemRegistry methodsFor:'initialization'!
       
   142 
       
   143 initialize
       
   144     "Invoked when a new instance is created."
       
   145 
       
   146     problems := WeakIdentityDictionary new.
       
   147 
       
   148     "Modified: / 06-08-2013 / 10:20:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   149 ! !
       
   150