Skip to content

Commit

Permalink
[refactoring] remove unneeded generics types declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
asolntsev committed Dec 28, 2023
1 parent fdfb399 commit be02e76
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,6 @@
*/
package org.xhtmlrenderer.resource;

import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.logging.Level;

import javax.xml.XMLConstants;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.sax.SAXSource;

import org.w3c.dom.Document;
import org.xhtmlrenderer.util.Configuration;
import org.xhtmlrenderer.util.XRLog;
Expand All @@ -54,6 +35,24 @@
import org.xml.sax.helpers.XMLFilterImpl;
import org.xml.sax.helpers.XMLReaderFactory;

import javax.xml.XMLConstants;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.sax.SAXSource;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
import java.util.Queue;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.logging.Level;


/**
* @author Patrick Wright
Expand Down Expand Up @@ -224,7 +223,7 @@ private Document transform(Source source) {
return (Document) result.getNode();
}

} // class XMLResourceBuilder
}


private static class XMLReaderPool extends ObjectPool<XMLReader> {
Expand Down Expand Up @@ -330,7 +329,7 @@ private void setFeature(XMLReader xmlReader, String featureUri, boolean value) {
}
}

} // class XMLReaderPool
}


private static class WhitespacePreservingFilter
Expand Down Expand Up @@ -374,7 +373,7 @@ public InputSource resolveEntity(String name,
return resolveEntity(publicId, systemId);
}

} // class SpacePreservingFilter
}


private static class IdentityTransformerPool extends ObjectPool<Transformer> {
Expand Down Expand Up @@ -407,15 +406,15 @@ protected Transformer newValue() {
}
}

} // class TranformerPool
}


private static abstract class ObjectPool<T> {

private final Queue<Reference<T>> pool;

ObjectPool(int capacity) {
pool = new ArrayBlockingQueue<Reference<T>>(capacity);
pool = new ArrayBlockingQueue<>(capacity);
}

protected abstract T newValue();
Expand All @@ -434,10 +433,10 @@ T get() {
}

void release(T obj) {
pool.offer(new SoftReference<T>(obj));
pool.offer(new SoftReference<>(obj));
}

} // class ObjectPool
}

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
public class XRLog {

private static final List<String> LOGGER_NAMES = new ArrayList<String>(20);
private static final List<String> LOGGER_NAMES = new ArrayList<>(20);
public static final String CONFIG = registerLoggerByName("org.xhtmlrenderer.config");
public static final String EXCEPTION = registerLoggerByName("org.xhtmlrenderer.exception");
public static final String GENERAL = registerLoggerByName("org.xhtmlrenderer.general");
Expand Down Expand Up @@ -67,7 +67,7 @@ private static String registerLoggerByName(final String loggerName) {
*/
public static List<String> listRegisteredLoggers() {
// defensive copy
return new ArrayList<String>(LOGGER_NAMES);
return new ArrayList<>(LOGGER_NAMES);
}


Expand Down Expand Up @@ -299,7 +299,7 @@ public static synchronized void setLoggerImpl(XRLogger loggerImpl) {
*
* $Log$
* Revision 1.20 2010/01/13 01:28:46 peterbrant
* Add synchronization to XRLog#log to avoid spurious errors on initializatoin
* Add synchronization to XRLog#log to avoid spurious errors on initialization
*
* Revision 1.19 2008/01/27 16:40:29 pdoubleya
* Issues 186 and 130: fix configuration so that logging setup does not override any current settings for JDK logging classes. Disable logging by default.
Expand All @@ -314,7 +314,7 @@ public static synchronized void setLoggerImpl(XRLogger loggerImpl) {
* CSS parsing errors should be logged at WARNING, not INFO level
*
* Revision 1.15 2006/08/17 17:32:25 joshy
* intial patch to fix the logging config issues
* initial patch to fix the logging config issues
* https://xhtmlrenderer.dev.java.net/issues/show_bug.cgi?id=130
*
* Revision 1.14 2006/07/26 17:59:01 pdoubleya
Expand Down

0 comments on commit be02e76

Please sign in to comment.