From 5064993263743d377f450eca172652358d02d11f Mon Sep 17 00:00:00 2001 From: author Date: Mon, 14 Oct 2019 09:23:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=EF=BC=8Csonar?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java | 2 +- .../gui/syntax/ui/rsyntaxtextarea/TokenIterator.java | 4 ++++ .../gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java | 9 +++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java index 4ee6fe978..b201365a8 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/SyntaxView.java @@ -656,7 +656,7 @@ public class SyntaxView extends View implements TabExpander, if (tabSize == 0) return x; int ntabs = (((int) x) - tabBase) / tabSize; - return tabBase + ((ntabs + 1) * tabSize); + return (float) (tabBase + ((ntabs + 1) * tabSize)); } diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/TokenIterator.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/TokenIterator.java index 189501894..0d3b493dd 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/TokenIterator.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/TokenIterator.java @@ -9,6 +9,7 @@ package com.fr.design.gui.syntax.ui.rsyntaxtextarea; import java.util.Iterator; +import java.util.NoSuchElementException; /** @@ -73,6 +74,9 @@ class TokenIterator implements Iterator { token = null; } } + else { + throw new NoSuchElementException(); + } return t; } diff --git a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java index e99208afc..97e367ef0 100644 --- a/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java +++ b/designer-base/src/main/java/com/fr/design/gui/syntax/ui/rsyntaxtextarea/WrappedSyntaxView.java @@ -268,7 +268,7 @@ public class WrappedSyntaxView extends BoxView implements TabExpander, if (host.getEOLMarkersVisible()) { g.setColor(host.getForegroundForTokenType(Token.WHITESPACE)); g.setFont(host.getFontForTokenType(Token.WHITESPACE)); - g.drawString("\u00B6", x, y-fontHeight); + g.drawString("\u00B6", x, (float) (y-fontHeight)); } } @@ -458,7 +458,7 @@ public class WrappedSyntaxView extends BoxView implements TabExpander, if (host.getEOLMarkersVisible()) { g.setColor(host.getForegroundForTokenType(Token.WHITESPACE)); g.setFont(host.getFontForTokenType(Token.WHITESPACE)); - g.drawString("\u00B6", x, y-fontHeight); + g.drawString("\u00B6", x, (float) (y-fontHeight)); } } @@ -841,10 +841,11 @@ public class WrappedSyntaxView extends BoxView implements TabExpander, * @return the tab stop, measured in points >= 0 */ public float nextTabStop(float x, int tabOffset) { - if (tabSize == 0) + if (tabSize == 0) { return x; + } int ntabs = ((int) x - tabBase) / tabSize; - return tabBase + ((ntabs + 1) * tabSize); + return (float) (tabBase + ((ntabs + 1) * tabSize)); }