# HG changeset patch # User Jan Vrany # Date 1427472651 0 # Node ID 3df0a2df585e580f8fd11f9bd1fa4af845b16421 # Parent 1cde6fd1d7c79509d43db213cf0078d00c52692b java lint: validate language and source code when running Java lint. - the language may not be Java any longer as lint is run in background and could have been changed meanwhile. - do not run the compiler at all if code is empty diff -r 1cde6fd1d7c7 -r 3df0a2df585e tools/JavaLintService.st --- a/tools/JavaLintService.st Fri Mar 27 16:37:34 2015 +0000 +++ b/tools/JavaLintService.st Fri Mar 27 16:10:51 2015 +0000 @@ -1,3 +1,5 @@ +"{ Encoding: utf8 }" + " COPYRIGHT (c) 2006 by eXept Software AG All Rights Reserved @@ -11,6 +13,8 @@ " "{ Package: 'stx:libjava/tools' }" +"{ NameSpace: Smalltalk }" + Tools::BackgroundSourceProcessingService subclass:#JavaLintService instanceVariableNames:'highlighter showingJava' classVariableNames:'Debugging' @@ -310,27 +314,33 @@ #processSafely: which handle possible errors and protect against 'debugger bomb'" + | lang | + done := false. modified := false. Delay waitForMilliseconds: 1000."Give user some time to finish coding" + lang := codeView language. + lang isJava ifFalse:[ ^ self ]. - modified ifFalse:[ | code | code := textView list asStringWithoutEmphasis. - modified ifFalse:[ - | problems | + code notEmptyOrNil ifTrue:[ + modified ifFalse:[ + | problems | - problems := JavaCompiler new check: code. - modified ifFalse:[ - highlighter problems: problems. - self rehighlight: delayed - ]. - ] + problems := JavaCompiler new check: code. + modified ifFalse:[ + highlighter problems: problems. + self rehighlight: delayed + ]. + ] + ]. ] "Created: / 07-08-2014 / 00:41:42 / Jan Vrany " + "Modified: / 27-03-2015 / 16:00:06 / Jan Vrany " ! ! !JavaLintService methodsFor:'redrawing'!