# HG changeset patch # User Jan Vrany # Date 1460576475 -3600 # Node ID 0aa3f8edbd06b71c4f032485d8483d7401d8515d # Parent f06e9aec6e672f7fd14c093d0e5c9bb49a2f538e JavaRelease: avoid useless and costly auto-detection of system release When a system release cannot be determined, try only once and return nil directly on subsequent calls to `JavaRelease class>>system`. This significantly speeds up settings dialog in such case. diff -r f06e9aec6e67 -r 0aa3f8edbd06 JavaRelease.st --- a/JavaRelease.st Fri Apr 08 10:35:17 2016 +0100 +++ b/JavaRelease.st Wed Apr 13 20:41:15 2016 +0100 @@ -1,5 +1,3 @@ -"{ Encoding: utf8 }" - " COPYRIGHT (c) 1996-2015 by Claus Gittinger @@ -26,7 +24,7 @@ Object subclass:#JavaRelease instanceVariableNames:'javaHome sourcePath classes bundle bootClassPath' - classVariableNames:'System' + classVariableNames:'System SystemInitialized' poolDictionaries:'' category:'Languages-Java-Support' ! @@ -170,12 +168,25 @@ Java release: nil. instance := nil. self subclasses do:[:e|e flush]. + System := nil. + SystemInitialized := false. " JavaRelease flush. " "Created: / 12-02-2013 / 03:20:05 / Jan Vrany " + "Modified: / 13-04-2016 / 20:30:23 / Jan Vrany " +! + +initialize + SystemInitialized := false. + + " + JavaRelease flush. + " + + "Created: / 13-04-2016 / 20:30:32 / Jan Vrany " ! ! !JavaRelease class methodsFor:'instance creation'! @@ -424,11 +435,12 @@ ^ release. ]. ] + ]. ^ nil. "Created: / 08-04-2014 / 14:12:42 / Jan Vrany " - "Modified: / 17-04-2014 / 20:03:03 / Jan Vrany " + "Modified: / 13-04-2016 / 20:25:12 / Jan Vrany " ! inDirectory:javaHome @@ -462,7 +474,7 @@ | javaExecutable | - System isNil ifTrue:[ + SystemInitialized ifFalse:[ "/ On Windows, search registry first... OperatingSystem isMSWINDOWSlike ifTrue:[ "Search for JDK first..." @@ -524,6 +536,7 @@ System := System class instance ]. ]. + SystemInitialized := true. ]. ^ System @@ -534,7 +547,7 @@ " "Created: / 11-11-2013 / 14:18:21 / Jan Vrany " - "Modified (comment): / 09-12-2014 / 14:03:34 / Jan Vrany " + "Modified: / 13-04-2016 / 20:31:26 / Jan Vrany " ! ! !JavaRelease class methodsFor:'instance creation-private'! @@ -3261,3 +3274,5 @@ ^ '$Id: JavaRelease.st,v 1.19 2015-03-31 07:43:05 az Exp $' ! ! + +JavaRelease initialize!