Skip to content
This repository has been archived by the owner on Sep 7, 2024. It is now read-only.

Commit

Permalink
Fixes violations for Checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
rainboyan committed Sep 27, 2022
1 parent cd6e8f0 commit bb8025e
Show file tree
Hide file tree
Showing 20 changed files with 403 additions and 405 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,6 @@ public GroovyPageMetaInfo(Class<?> pageClass) {
}
}

interface GroovyPageMetaInfoInitializer {

void initialize(GroovyPageMetaInfo metaInfo);

}

synchronized void initializeOnDemand(GroovyPageMetaInfoInitializer initializer) {
if (!initialized) {
initializer.initialize(this);
Expand Down Expand Up @@ -574,4 +568,10 @@ public void writeToFinished(Writer out) {
}
}

interface GroovyPageMetaInfoInitializer {

void initialize(GroovyPageMetaInfo metaInfo);

}

}
19 changes: 9 additions & 10 deletions grails-gsp/src/main/groovy/org/grails/gsp/GroovyPageWritable.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public GroovyPageWritable(GroovyPageMetaInfo metaInfo, OutputContextLookup outpu
this.allowSettingContentType = allowSettingContentType;
}


/**
* This sets any additional variables that need to be placed in the Binding of the GSP page.
*
Expand Down Expand Up @@ -192,15 +191,6 @@ public void setShowSource(boolean showSource) {
this.showSource = showSource;
}

private static final class GspNoneCodec {

@SuppressWarnings("unused")
public Object encode(Object object) {
return object;
}

}

private GroovyPageBinding createBinding(Binding parent) {
GroovyPageBinding binding = new GroovyPageBinding();
binding.setParent(parent);
Expand Down Expand Up @@ -310,4 +300,13 @@ protected void writeGroovySourceToResponse(GroovyPageMetaInfo info, Writer out)
}
}

private static final class GspNoneCodec {

@SuppressWarnings("unused")
public Object encode(Object object) {
return object;
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -138,48 +138,6 @@ public class GroovyPagesTemplateEngine extends ResourceAwareTemplateEngine
}
}

private class GroovyPagesTemplateEngineCacheEntry extends CacheEntry<GroovyPageMetaInfo> {

private final String pageName;

GroovyPagesTemplateEngineCacheEntry(String pageName) {
this.pageName = pageName;
}

@Override
protected boolean hasExpired(long timeout, Object cacheRequestObject) {
GroovyPageMetaInfo meta = getValue();
Resource resource = (Resource) cacheRequestObject;
return meta == null || isGroovyPageReloadable(resource, meta);
}

@Override
protected GroovyPageMetaInfo updateValue(GroovyPageMetaInfo oldValue, Callable<GroovyPageMetaInfo> updater, Object cacheRequestObject)
throws Exception {
if (oldValue != null) {
oldValue.removePageMetaClass();
}
Resource resource = (Resource) cacheRequestObject;
return buildPageMetaInfo(resource, pageName);
}

}

private static class GroovyPagesTemplateEngineCallable implements Callable<CacheEntry<GroovyPageMetaInfo>> {

private final CacheEntry<GroovyPageMetaInfo> cacheEntry;

GroovyPagesTemplateEngineCallable(CacheEntry<GroovyPageMetaInfo> cacheEntry) {
this.cacheEntry = cacheEntry;
}

@Override
public CacheEntry<GroovyPageMetaInfo> call() throws Exception {
return cacheEntry;
}

}

public GroovyPagesTemplateEngine() {
// default
}
Expand Down Expand Up @@ -844,4 +802,46 @@ public String getGspEncoding() {
return this.gspEncoding;
}

private class GroovyPagesTemplateEngineCacheEntry extends CacheEntry<GroovyPageMetaInfo> {

private final String pageName;

GroovyPagesTemplateEngineCacheEntry(String pageName) {
this.pageName = pageName;
}

@Override
protected boolean hasExpired(long timeout, Object cacheRequestObject) {
GroovyPageMetaInfo meta = getValue();
Resource resource = (Resource) cacheRequestObject;
return meta == null || isGroovyPageReloadable(resource, meta);
}

@Override
protected GroovyPageMetaInfo updateValue(GroovyPageMetaInfo oldValue, Callable<GroovyPageMetaInfo> updater, Object cacheRequestObject)
throws Exception {
if (oldValue != null) {
oldValue.removePageMetaClass();
}
Resource resource = (Resource) cacheRequestObject;
return buildPageMetaInfo(resource, pageName);
}

}

private static class GroovyPagesTemplateEngineCallable implements Callable<CacheEntry<GroovyPageMetaInfo>> {

private final CacheEntry<GroovyPageMetaInfo> cacheEntry;

GroovyPagesTemplateEngineCallable(CacheEntry<GroovyPageMetaInfo> cacheEntry) {
this.cacheEntry = cacheEntry;
}

@Override
public CacheEntry<GroovyPageMetaInfo> call() throws Exception {
return cacheEntry;
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -261,55 +261,6 @@ public class GroovyPageParser implements Tokens {

private Set<String> allowedTaglibNamespaces = new LinkedHashSet<>(DEFAULT_TAGLIB_NAMESPACES);

public String getContentType() {
return contentType;
}

public int getCurrentOutputLineNumber() {
return scan.getLineNumberForToken();
}

public Map<String, String> getJspTags() {
return jspTags;
}

public void setKeepGeneratedDirectory(File keepGeneratedDirectory) {
this.keepGeneratedDirectory = keepGeneratedDirectory;
}

public void setEnableSitemeshPreprocessing(boolean enableSitemeshPreprocessing) {
this.enableSitemeshPreprocessing = enableSitemeshPreprocessing;
}

class TagMeta {

String name;

String namespace;

Object instance;

boolean isDynamic;

boolean hasAttributes;

int lineNumber;

boolean emptyTag;

int tagIndex;

boolean bufferMode = false;

int bufferPartNumber = -1;

@Override
public String toString() {
return "<" + namespace + ":" + name + ">";
}

}

public GroovyPageParser(String name, String uri, String filename, InputStream in, String encoding, String expressionCodecName)
throws IOException {
this(name, uri, filename, readStream(in, encoding), expressionCodecName);
Expand Down Expand Up @@ -342,11 +293,30 @@ public GroovyPageParser(String name, String uri, String filename, String gspSour
makeSourceName(filename);
}


public GroovyPageParser(String name, String uri, String filename, InputStream in) throws IOException {
this(name, uri, filename, in, null, null);
}

public String getContentType() {
return contentType;
}

public int getCurrentOutputLineNumber() {
return scan.getLineNumberForToken();
}

public Map<String, String> getJspTags() {
return jspTags;
}

public void setKeepGeneratedDirectory(File keepGeneratedDirectory) {
this.keepGeneratedDirectory = keepGeneratedDirectory;
}

public void setEnableSitemeshPreprocessing(boolean enableSitemeshPreprocessing) {
this.enableSitemeshPreprocessing = enableSitemeshPreprocessing;
}

/**
* Configures the parser for the given Config map
*
Expand Down Expand Up @@ -767,7 +737,6 @@ public void flushTagBuffering() {
}
}


private void html() {
if (!finalPass) {
return;
Expand Down Expand Up @@ -1584,4 +1553,33 @@ public boolean isModelFieldsMode() {
return modelFieldsMode;
}

class TagMeta {

String name;

String namespace;

Object instance;

boolean isDynamic;

boolean hasAttributes;

int lineNumber;

boolean emptyTag;

int tagIndex;

boolean bufferMode = false;

int bufferPartNumber = -1;

@Override
public String toString() {
return "<" + namespace + ":" + name + ">";
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*
* Date: Jan 10, 2004
*/
@SuppressWarnings("checkstyle:InterfaceIsType")
interface Tokens {

int EOF = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
* @author Graeme Rocher
*/
public class GrailsTagRegistry {
public final class GrailsTagRegistry {

private static GrailsTagRegistry instance = new GrailsTagRegistry();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,14 @@ public static PluginViewPathInfo getPluginViewPathInfo(String uri) {
return new PluginViewPathInfo(uri);
}

public boolean isReloadEnabled() {
return reloadEnabled;
}

public void setReloadEnabled(boolean reloadEnabled) {
this.reloadEnabled = reloadEnabled;
}

public static class PluginViewPathInfo {

public String basePath;
Expand All @@ -468,12 +476,4 @@ public PluginViewPathInfo(String uri) {

}

public boolean isReloadEnabled() {
return reloadEnabled;
}

public void setReloadEnabled(boolean reloadEnabled) {
this.reloadEnabled = reloadEnabled;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/**
* Created by lari on 16/07/14.
*/
public class TagOutput {
public final class TagOutput {

public static final String APPLY_CODEC_TAG_NAME = "applyCodec";

Expand All @@ -45,7 +45,7 @@ private TagOutput() {
}

@SuppressWarnings("rawtypes")
public static final Object captureTagOutput(TagLibraryLookup gspTagLibraryLookup, String namespace,
public static Object captureTagOutput(TagLibraryLookup gspTagLibraryLookup, String namespace,
String tagName, Map attrs, Object body, OutputContext outputContext) {

GroovyObject tagLib = lookupCachedTagLib(gspTagLibraryLookup, namespace, tagName);
Expand Down Expand Up @@ -136,13 +136,13 @@ public static final Object captureTagOutput(TagLibraryLookup gspTagLibraryLookup
}
}

public static final GroovyObject lookupCachedTagLib(TagLibraryLookup gspTagLibraryLookup,
public static GroovyObject lookupCachedTagLib(TagLibraryLookup gspTagLibraryLookup,
String namespace, String tagName) {

return gspTagLibraryLookup != null ? gspTagLibraryLookup.lookupTagLibrary(namespace, tagName) : null;
}

public static final Closure<?> createOutputCapturingClosure(Object wrappedInstance, final Object body1,
public static Closure<?> createOutputCapturingClosure(Object wrappedInstance, final Object body1,
final OutputContext outputContext) {
if (body1 == null) {
return EMPTY_BODY_CLOSURE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @author Lari Hotari
* @author Graeme Rocher
*/
public class OutputContextLookupHelper {
public final class OutputContextLookupHelper {

private static final OutputContextLookup outputContextLookup;

Expand Down
Loading

0 comments on commit bb8025e

Please sign in to comment.