From 8970d005176c83e9f1d21086346a89a97f14843b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20K=C3=BChne?= Date: Thu, 5 Dec 2002 06:47:38 +0000 Subject: [PATCH] hide default constructor in FullIdent and make the class final. Instances should only be created through the factory method --- .../com/puppycrawl/tools/checkstyle/api/FullIdent.java | 10 ++++++---- .../tools/checkstyle/checks/JavadocMethodCheck.java | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/FullIdent.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/FullIdent.java index 1d6dcae62..0a11dcc87 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/api/FullIdent.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/api/FullIdent.java @@ -31,10 +31,8 @@ package com.puppycrawl.tools.checkstyle.api; * * @author Oliver Burn **/ -public class FullIdent +public final class FullIdent { - // TODO: We should hide public default constructor. - /** the string **/ private final StringBuffer mBuffer = new StringBuffer(); /** the line number **/ @@ -42,6 +40,11 @@ public class FullIdent /** the column number **/ private int mColNo; + /** hide default constructor */ + private FullIdent() + { + } + /** @return the text **/ public String getText() { @@ -112,7 +115,6 @@ public class FullIdent */ private static void extractFullIdent(FullIdent aFull, DetailAST aAST) { - // A guard to be paranoid if (aAST == null) { return; } diff --git a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/JavadocMethodCheck.java b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/JavadocMethodCheck.java index 6f088ba81..2bd80ac1a 100644 --- a/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/JavadocMethodCheck.java +++ b/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/JavadocMethodCheck.java @@ -160,7 +160,7 @@ public class JavadocMethodCheck /** @see com.puppycrawl.tools.checkstyle.api.Check */ public void beginTree() { - mPackageFullIdent = new FullIdent(); + mPackageFullIdent = FullIdent.createFullIdent(null); mImports.clear(); }