Skip to content

Commit

Permalink
Merge pull request #2280 from desmorto/refactor-diamond-operator
Browse files Browse the repository at this point in the history
(refactor) some opportunities to use diamond operator
  • Loading branch information
jfarcand committed Jul 19, 2017
2 parents 0ae9da2 + 62c6302 commit d51726d
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void handle(AtmosphereFramework framework, Class<AtmosphereHandler> annot
filters(a.broadcastFilters(), framework);

Class<?>[] interceptors = a.interceptors();
LinkedList<AtmosphereInterceptor> l = new LinkedList<AtmosphereInterceptor>();
LinkedList<AtmosphereInterceptor> l = new LinkedList<>();
for (Class i : interceptors) {
try {
AtmosphereInterceptor ai = (AtmosphereInterceptor) framework.newClassInstance(AtmosphereHandler.class, i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void handle(AtmosphereFramework framework, Class<Servlet> annotatedClass)
try {
ReflectorServletProcessor r = framework.newClassInstance(ReflectorServletProcessor.class, ReflectorServletProcessor.class);
r.setServletClassName(annotatedClass.getName());
LinkedList<AtmosphereInterceptor> l = new LinkedList<AtmosphereInterceptor>();
LinkedList<AtmosphereInterceptor> l = new LinkedList<>();

MeteorService m = annotatedClass.getAnnotation(MeteorService.class);
framework.setBroadcasterCacheClassName(m.broadcasterCache().getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public List<Object> retrieveFromCache(String broadcasterId, String uuid) {
throw new IllegalArgumentException("AtmosphereResource can't be null");
}

List<Object> result = new ArrayList<Object>();
List<Object> result = new ArrayList<>();
try {
AtmosphereResource r = config.resourcesFactory().find(uuid);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ public class ManagedAtmosphereHandler extends AbstractReflectorAtmosphereHandler
protected boolean pathParams;
protected AtmosphereResourceFactory resourcesFactory;

final Map<Method, List<Encoder<?, ?>>> encoders = new HashMap<Method, List<Encoder<?, ?>>>();
final Map<Method, List<Decoder<?, ?>>> decoders = new HashMap<Method, List<Decoder<?, ?>>>();
final Map<Method, List<Encoder<?, ?>>> encoders = new HashMap<>();
final Map<Method, List<Decoder<?, ?>>> decoders = new HashMap<>();

public ManagedAtmosphereHandler() {
}
Expand Down Expand Up @@ -269,7 +269,7 @@ protected Method populate(Object c, Class<? extends Annotation> annotation) {
}

protected List<MethodInfo> populateMessage(Object c, Class<? extends Annotation> annotation) {
ArrayList<MethodInfo> methods = new ArrayList<MethodInfo>();
ArrayList<MethodInfo> methods = new ArrayList<>();
for (Method m : c.getClass().getMethods()) {
if (m.isAnnotationPresent(annotation)) {
methods.add(new MethodInfo(m));
Expand All @@ -293,7 +293,7 @@ private void scanForReaderOrInputStream() {

private void populateEncoders() {
for (MethodInfo m : onRuntimeMethod) {
List<Encoder<?, ?>> l = new CopyOnWriteArrayList<Encoder<?, ?>>();
List<Encoder<?, ?>> l = new CopyOnWriteArrayList<>();
for (Class<? extends Encoder> s : m.method.getAnnotation(Message.class).encoders()) {
try {
l.add(config.framework().newClassInstance(Encoder.class, s));
Expand All @@ -305,7 +305,7 @@ private void populateEncoders() {
}

if (onReadyMethod != null) {
List<Encoder<?, ?>> l = new CopyOnWriteArrayList<Encoder<?, ?>>();
List<Encoder<?, ?>> l = new CopyOnWriteArrayList<>();
for (Class<? extends Encoder> s : onReadyMethod.getAnnotation(Ready.class).encoders()) {
try {
l.add(config.framework().newClassInstance(Encoder.class, s));
Expand All @@ -319,7 +319,7 @@ private void populateEncoders() {

private void populateDecoders() {
for (MethodInfo m : onRuntimeMethod) {
List<Decoder<?, ?>> l = new CopyOnWriteArrayList<Decoder<?, ?>>();
List<Decoder<?, ?>> l = new CopyOnWriteArrayList<>();
for (Class<? extends Decoder> s : m.method.getAnnotation(Message.class).decoders()) {
try {
l.add(config.framework().newClassInstance(Decoder.class, s));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public AnnotationHandler() {
}

public AnnotationHandler flushCoreAnnotations(Set<Class<?>> classes){
List<Class<? extends Annotation>> l = new ArrayList<Class<? extends Annotation>>();
List<Class<? extends Annotation>> l = new ArrayList<>();
for (Map.Entry<Class<? extends Annotation>, Class<? extends Processor>> e : annotations.entrySet()) {
if (e.getValue().getPackage().getName().equals("org.atmosphere.annotation") && classes.contains(e.getValue())) {
l.add(e.getKey());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ public void destroy() {

AtmosphereRequest request = new AtmosphereRequestImpl.Builder().pathInfo("/a").build();

final AtomicReference<Boolean> suspended = new AtomicReference<Boolean>();
final AtomicReference<Boolean> resumed = new AtomicReference<Boolean>();
final AtomicReference<Boolean> disconnected = new AtomicReference<Boolean>();
final AtomicReference<Boolean> preSuspended = new AtomicReference<Boolean>();
final AtomicReference<Boolean> broadcasted = new AtomicReference<Boolean>();
final AtomicReference<Boolean> suspended = new AtomicReference<>();
final AtomicReference<Boolean> resumed = new AtomicReference<>();
final AtomicReference<Boolean> disconnected = new AtomicReference<>();
final AtomicReference<Boolean> preSuspended = new AtomicReference<>();
final AtomicReference<Boolean> broadcasted = new AtomicReference<>();

final AtmosphereResourceEventListener listener = new AtmosphereResourceEventListener() {

Expand Down Expand Up @@ -167,7 +167,7 @@ public void destroy() {

AtmosphereRequest request = new AtmosphereRequestImpl.Builder().pathInfo("/a").build();

final AtomicReference<Boolean> closed = new AtomicReference<Boolean>();
final AtomicReference<Boolean> closed = new AtomicReference<>();

final AtmosphereResourceEventListener listener = new AtmosphereResourceEventListenerAdapter() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public void restorePartialStateTest() throws ServletException, IOException {

@Test(enabled = false)
public void longPollingAggregatedTest() throws ServletException, IOException, ExecutionException, InterruptedException {
final AtomicReference<Object> ref = new AtomicReference<Object>();
final AtomicReference<Object> ref = new AtomicReference<>();
AtmosphereResourceImpl r = (AtmosphereResourceImpl) config.resourcesFactory().create(config, "1234567");
r.setBroadcaster(config.getBroadcasterFactory().lookup("/1", true));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ public void destroy() {

AtmosphereRequest request = new AtmosphereRequestImpl.Builder().pathInfo("/a").build();

final AtomicReference<String> e = new AtomicReference<String>();
final AtomicReference<String> e2 = new AtomicReference<String>();
final AtomicReference<String> e = new AtomicReference<>();
final AtomicReference<String> e2 = new AtomicReference<>();

framework.interceptor(new AtmosphereInterceptor() {
@Override
Expand Down Expand Up @@ -180,7 +180,7 @@ public void run() {
}.start();

suspended.await();
Map<String, Object> m = new HashMap<String, Object>();
Map<String, Object> m = new HashMap<>();
m.put(SUSPENDED_ATMOSPHERE_RESOURCE_UUID, parentRequest.resource().uuid());

AtmosphereRequest request = new AtmosphereRequestImpl.Builder().attributes(m).pathInfo("/a").queryString(HeaderConfig.WEBSOCKET_X_ATMOSPHERE_TRANSPORT).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void testOnRemove() throws IOException, ServletException {
public void testLongPollingOnBroadcast() throws IOException, ServletException {
framework.addAtmosphereHandler("/*", new BAR()).init();

Map<String, String> m = new HashMap<String, String>();
Map<String, String> m = new HashMap<>();
m.put(HeaderConfig.X_ATMOSPHERE_TRANSPORT, HeaderConfig.LONG_POLLING_TRANSPORT);
AtmosphereRequest request = new AtmosphereRequestImpl.Builder().headers(m).pathInfo("/a").method("GET").build();
framework.doCometSupport(request, AtmosphereResponseImpl.newInstance());
Expand All @@ -140,7 +140,7 @@ public void testLongPollingOnBroadcast() throws IOException, ServletException {
public void testCachedOnBroadcast() throws IOException, ServletException {
framework.setBroadcasterCacheClassName(UUIDBroadcasterCache.class.getName()).addAtmosphereHandler("/*", new CachedAR()).init();

Map<String, String> m = new HashMap<String, String>();
Map<String, String> m = new HashMap<>();
m.put(HeaderConfig.X_ATMOSPHERE_TRACKING_ID, UUID.randomUUID().toString());
m.put(HeaderConfig.X_ATMOSPHERE_TRANSPORT, HeaderConfig.LONG_POLLING_TRANSPORT);
AtmosphereRequest request = new AtmosphereRequestImpl.Builder().headers(m).pathInfo("/a").method("GET").build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void destroy() {
}
});

Map<String, String> reqheaders = new HashMap<String, String>();
Map<String, String> reqheaders = new HashMap<>();
if (enabled) {
reqheaders.put(HeaderConfig.X_ATMOSPHERE_TRACKMESSAGESIZE, "true");
}
Expand Down

0 comments on commit d51726d

Please sign in to comment.