    /**
     * Get the inbound request.  If there is no request body, calling this method
     * may cause the next request to immediately be processed.  The {@link StreamSourceChannel#close()} or {@link StreamSourceChannel#shutdownReads()}
     * method must be called at some point after the request is processed to prevent resource leakage and to allow
     * the next request to proceed.  Any unread content will be discarded.
     *
     * @return the channel for the inbound request, or {@code null} if another party already acquired the channel
     */
    public StreamSourceChannel getRequestChannel() {
        if (requestChannel != null) {
            return null;
        }
        if (anyAreSet(state, FLAG_REQUEST_TERMINATED)) {
            return requestChannel = new ReadDispatchChannel(new ConduitStreamSourceChannel(Configurable.EMPTY, new EmptyStreamSourceConduit(getIoThread())));
        }
        final ConduitWrapper<StreamSourceConduit>[] wrappers = this.requestWrappers;
        final ConduitStreamSourceChannel sourceChannel = connection.getSourceChannel();
        if (wrappers != null) {
            this.requestWrappers = null;
            final WrapperConduitFactory<StreamSourceConduit> factory = new WrapperConduitFactory<>(wrappers, requestWrapperCount, sourceChannel.getConduit(), this);
            sourceChannel.setConduit(factory.create());
        }
        return requestChannel = new ReadDispatchChannel(sourceChannel);
    }

    /**
     * Get the inbound request.  If there is no request body, calling this method
     * may cause the next request to immediately be processed.  The {@link StreamSourceChannel#close()} or {@link StreamSourceChannel#shutdownReads()}
     * method must be called at some point after the request is processed to prevent resource leakage and to allow
     * the next request to proceed.  Any unread content will be discarded.
     *
     * @return the channel for the inbound request, or {@code null} if another party already acquired the channel
     */
    public StreamSourceChannel getRequestChannel() {
        if (requestChannel != null) {
            return null;
        }
        if (anyAreSet(state, FLAG_REQUEST_TERMINATED)) {
            return requestChannel = new ReadDispatchChannel(new ConduitStreamSourceChannel(Configurable.EMPTY, new EmptyStreamSourceConduit(getIoThread())));
        }
        final ConduitWrapper<StreamSourceConduit>[] wrappers = this.requestWrappers;
        final ConduitStreamSourceChannel sourceChannel = connection.getSourceChannel();
        if (wrappers != null) {
            this.requestWrappers = null;
            final WrapperConduitFactory<StreamSourceConduit> factory = new WrapperConduitFactory<StreamSourceConduit>(wrappers, requestWrapperCount, sourceChannel.getConduit(), this);
            sourceChannel.setConduit(factory.create());
        }
        return requestChannel = new ReadDispatchChannel(sourceChannel);
    }

Replace Generic With Diamond WrapperConduitFactory<StreamSourceConduit> with WrapperConduitFactory<> in method public getRequestChannel() : StreamSourceChannel from class io.undertow.server.HttpServerExchange


    public synchronized RoutingHandler add(HttpString method, String template, HttpHandler handler) {
        PathTemplateMatcher<RoutingMatch> matcher = matches.get(method);
        if (matcher == null) {
            matches.put(method, matcher = new PathTemplateMatcher<>());
        }
        RoutingMatch res = matcher.get(template);
        if (res == null) {
            matcher.add(template, res = new RoutingMatch());
        }
        res.defaultHandler = handler;
        return this;
    }

    public synchronized RoutingHandler add(HttpString method, String template, HttpHandler handler) {
        PathTemplateMatcher<RoutingMatch> matcher = matches.get(method);
        if (matcher == null) {
            matches.put(method, matcher = new PathTemplateMatcher<RoutingMatch>());
        }
        RoutingMatch res = matcher.get(template);
        if (res == null) {
            matcher.add(template, res = new RoutingMatch());
        }
        res.defaultHandler = handler;
        return this;
    }

Replace Generic With Diamond PathTemplateMatcher<RoutingMatch> with PathTemplateMatcher<> in method public add(method HttpString, template String, handler HttpHandler) : RoutingHandler from class io.undertow.server.RoutingHandler


    public synchronized RoutingHandler add(HttpString method, String template, Predicate predicate, HttpHandler handler) {
        PathTemplateMatcher<RoutingMatch> matcher = matches.get(method);
        if (matcher == null) {
            matches.put(method, matcher = new PathTemplateMatcher<>());
        }
        RoutingMatch res = matcher.get(template);
        if (res == null) {
            matcher.add(template, res = new RoutingMatch());
        }
        res.predicatedHandlers.add(new HandlerHolder(predicate, handler));
        return this;
    }

    public synchronized RoutingHandler add(HttpString method, String template, Predicate predicate, HttpHandler handler) {
        PathTemplateMatcher<RoutingMatch> matcher = matches.get(method);
        if (matcher == null) {
            matches.put(method, matcher = new PathTemplateMatcher<RoutingMatch>());
        }
        RoutingMatch res = matcher.get(template);
        if (res == null) {
            matcher.add(template, res = new RoutingMatch());
        }
        res.predicatedHandlers.add(new HandlerHolder(predicate, handler));
        return this;
    }

Replace Generic With Diamond PathTemplateMatcher<RoutingMatch> with PathTemplateMatcher<> in method public add(method HttpString, template String, predicate Predicate, handler HttpHandler) : RoutingHandler from class io.undertow.server.RoutingHandler


    public AllowedMethodsHandler(final HttpHandler next, final Set<HttpString> allowedMethods) {
        this.allowedMethods = new HashSet<>(allowedMethods);
        this.next = next;
    }

    public AllowedMethodsHandler(final HttpHandler next, final Set<HttpString> allowedMethods) {
        this.allowedMethods = new HashSet<HttpString>(allowedMethods);
        this.next = next;
    }

Replace Generic With Diamond HashSet<HttpString> with HashSet<> in method public AllowedMethodsHandler(next HttpHandler, allowedMethods Set<HttpString>) from class io.undertow.server.handlers.AllowedMethodsHandler


    public AllowedMethodsHandler(final HttpHandler next, final HttpString... allowedMethods) {
        this.allowedMethods = new HashSet<>(Arrays.asList(allowedMethods));
        this.next = next;
    }

    public AllowedMethodsHandler(final HttpHandler next, final HttpString... allowedMethods) {
        this.allowedMethods = new HashSet<HttpString>(Arrays.asList(allowedMethods));
        this.next = next;
    }

Replace Generic With Diamond HashSet<HttpString> with HashSet<> in method public AllowedMethodsHandler(next HttpHandler, allowedMethods HttpString...) from class io.undertow.server.handlers.AllowedMethodsHandler


    /**
     * Add a protocol to this handler.
     *
     * @param productString the product string to match
     * @param openListener  the open listener to call
     * @param handshake     a handshake implementation that can be used to verify the client request and modify the response
     */
    public synchronized void addProtocol(String productString, ChannelListener<? super StreamConnection> openListener, final HttpUpgradeHandshake handshake) {
        if (productString == null) {
            throw new IllegalArgumentException("productString is null");
        }
        if (openListener == null) {
            throw new IllegalArgumentException("openListener is null");
        }
        List<Holder> list = handlers.get(productString);
        if (list == null) {
            handlers.put(productString, list = new CopyOnWriteArrayList<>());
        }
        list.add(new Holder(openListener, handshake));
    }

    /**
     * Add a protocol to this handler.
     *
     * @param productString the product string to match
     * @param openListener  the open listener to call
     * @param handshake     a handshake implementation that can be used to verify the client request and modify the response
     */
    public synchronized void addProtocol(String productString, ChannelListener<? super StreamConnection> openListener, final HttpUpgradeHandshake handshake) {
        if (productString == null) {
            throw new IllegalArgumentException("productString is null");
        }
        if (openListener == null) {
            throw new IllegalArgumentException("openListener is null");
        }
        List<Holder> list = handlers.get(productString);
        if (list == null) {
            handlers.put(productString, list = new CopyOnWriteArrayList<Holder>());
        }
        list.add(new Holder(openListener, handshake));
    }

Replace Generic With Diamond CopyOnWriteArrayList<Holder> with CopyOnWriteArrayList<> in method public addProtocol(productString String, openListener ChannelListener<? super StreamConnection>, handshake HttpUpgradeHandshake) : void from class io.undertow.server.handlers.ChannelUpgradeHandler


    public DisallowedMethodsHandler(final HttpHandler next, final Set<HttpString> disallowedMethods) {
        this.disallowedMethods = new HashSet<>(disallowedMethods);
        this.next = next;
    }

    public DisallowedMethodsHandler(final HttpHandler next, final Set<HttpString> disallowedMethods) {
        this.disallowedMethods = new HashSet<HttpString>(disallowedMethods);
        this.next = next;
    }

Replace Generic With Diamond HashSet<HttpString> with HashSet<> in method public DisallowedMethodsHandler(next HttpHandler, disallowedMethods Set<HttpString>) from class io.undertow.server.handlers.DisallowedMethodsHandler


    public DisallowedMethodsHandler(final HttpHandler next, final HttpString... disallowedMethods) {
        this.disallowedMethods = new HashSet<>(Arrays.asList(disallowedMethods));
        this.next = next;
    }

    public DisallowedMethodsHandler(final HttpHandler next, final HttpString... disallowedMethods) {
        this.disallowedMethods = new HashSet<HttpString>(Arrays.asList(disallowedMethods));
        this.next = next;
    }

Replace Generic With Diamond HashSet<HttpString> with HashSet<> in method public DisallowedMethodsHandler(next HttpHandler, disallowedMethods HttpString...) from class io.undertow.server.handlers.DisallowedMethodsHandler


    public JDBCLogHandler(final HttpHandler next, final Executor logWriteExecutor, final String formatString, DataSource dataSource) {
        this.next = next;
        this.formatString = formatString;
        this.dataSource = dataSource;

        tableName = "access";
        remoteHostField = "remoteHost";
        userField = "userName";
        timestampField = "timestamp";
        virtualHostField = "virtualHost";
        methodField = "method";
        queryField = "query";
        statusField = "status";
        bytesField = "bytes";
        refererField = "referer";
        userAgentField = "userAgent";
        this.logWriteExecutor = logWriteExecutor;
        this.pendingMessages = new ConcurrentLinkedDeque<>();
    }

    public JDBCLogHandler(final HttpHandler next, final Executor logWriteExecutor, final String formatString, DataSource dataSource) {
        this.next = next;
        this.formatString = formatString;
        this.dataSource = dataSource;

        tableName = "access";
        remoteHostField = "remoteHost";
        userField = "userName";
        timestampField = "timestamp";
        virtualHostField = "virtualHost";
        methodField = "method";
        queryField = "query";
        statusField = "status";
        bytesField = "bytes";
        refererField = "referer";
        userAgentField = "userAgent";
        this.logWriteExecutor = logWriteExecutor;
        this.pendingMessages = new ConcurrentLinkedDeque<JDBCLogAttribute>();
    }

Replace Generic With Diamond ConcurrentLinkedDeque<JDBCLogAttribute> with ConcurrentLinkedDeque<> in method public JDBCLogHandler(next HttpHandler, logWriteExecutor Executor, formatString String, dataSource DataSource) from class io.undertow.server.handlers.JDBCLogHandler


    /**
     * insert the log record to database
     */
    @Override
    public void run() {
        if (!stateUpdater.compareAndSet(this, 1, 2)) {
            return;
        }

        List<JDBCLogAttribute> messages = new ArrayList<>();
        JDBCLogAttribute msg = null;

        //only grab at most 1000 messages at a time
        for (int i = 0; i < 1000; ++i) {
            msg = pendingMessages.poll();
            if (msg == null) {
                break;
            }
            messages.add(msg);
        }
        try {
            if (!messages.isEmpty()) {
                writeMessage(messages);
            }
        } finally {
            stateUpdater.set(this, 0);
            //check to see if there is still more messages
            //if so then run this again
            if (!pendingMessages.isEmpty()) {
                if (stateUpdater.compareAndSet(this, 0, 1)) {
                    logWriteExecutor.execute(this);
                }
            }
        }
    }

    /**
     * insert the log record to database
     */
    @Override
    public void run() {
        if (!stateUpdater.compareAndSet(this, 1, 2)) {
            return;
        }

        List<JDBCLogAttribute> messages = new ArrayList<JDBCLogAttribute>();
        JDBCLogAttribute msg = null;

        //only grab at most 1000 messages at a time
        for (int i = 0; i < 1000; ++i) {
            msg = pendingMessages.poll();
            if (msg == null) {
                break;
            }
            messages.add(msg);
        }
        try {
            if (!messages.isEmpty()) {
                writeMessage(messages);
            }
        } finally {
            stateUpdater.set(this, 0);
            //check to see if there is still more messages
            //if so then run this again
            if (!pendingMessages.isEmpty()) {
                if (stateUpdater.compareAndSet(this, 0, 1)) {
                    logWriteExecutor.execute(this);
                }
            }
        }
    }

Replace Generic With Diamond ArrayList<JDBCLogAttribute> with ArrayList<> in method public run() : void from class io.undertow.server.handlers.JDBCLogHandler


    public synchronized OriginHandler addAllowedOrigin(final String origin) {
        final Set<String> allowedOrigins = new HashSet<>(this.allowedOrigins);
        allowedOrigins.add(origin);
        this.allowedOrigins = Collections.unmodifiableSet(allowedOrigins);
        return this;
    }

    public synchronized OriginHandler addAllowedOrigin(final String origin) {
        final Set<String> allowedOrigins = new HashSet<String>(this.allowedOrigins);
        allowedOrigins.add(origin);
        this.allowedOrigins = Collections.unmodifiableSet(allowedOrigins);
        return this;
    }

Replace Generic With Diamond HashSet<String> with HashSet<> in method public addAllowedOrigin(origin String) : OriginHandler from class io.undertow.server.handlers.OriginHandler


    public synchronized OriginHandler addAllowedOrigins(final Collection<String> origins) {
        final Set<String> allowedOrigins = new HashSet<>(this.allowedOrigins);
        allowedOrigins.addAll(origins);
        this.allowedOrigins = Collections.unmodifiableSet(allowedOrigins);
        return this;
    }

    public synchronized OriginHandler addAllowedOrigins(final Collection<String> origins) {
        final Set<String> allowedOrigins = new HashSet<String>(this.allowedOrigins);
        allowedOrigins.addAll(origins);
        this.allowedOrigins = Collections.unmodifiableSet(allowedOrigins);
        return this;
    }

Replace Generic With Diamond HashSet<String> with HashSet<> in method public addAllowedOrigins(origins Collection<String>) : OriginHandler from class io.undertow.server.handlers.OriginHandler


    public synchronized OriginHandler addAllowedOrigins(final String... origins) {
        final Set<String> allowedOrigins = new HashSet<>(this.allowedOrigins);
        allowedOrigins.addAll(Arrays.asList(origins));
        this.allowedOrigins = Collections.unmodifiableSet(allowedOrigins);
        return this;
    }

    public synchronized OriginHandler addAllowedOrigins(final String... origins) {
        final Set<String> allowedOrigins = new HashSet<String>(this.allowedOrigins);
        allowedOrigins.addAll(Arrays.asList(origins));
        this.allowedOrigins = Collections.unmodifiableSet(allowedOrigins);
        return this;
    }

Replace Generic With Diamond HashSet<String> with HashSet<> in method public addAllowedOrigins(origins String...) : OriginHandler from class io.undertow.server.handlers.OriginHandler


    /**
     * Construct a new instance. The maximum number of concurrent requests must be at least one.
     *
     * @param maximumConcurrentRequests the maximum concurrent requests
     * @param queueSize                 The maximum number of requests to queue
     */
    public RequestLimit(int maximumConcurrentRequests, int queueSize) {
        if (maximumConcurrentRequests < 1) {
            throw new IllegalArgumentException("Maximum concurrent requests must be at least 1");
        }
        state = (maximumConcurrentRequests & 0xFFFFFFFFL) << 32;

        this.queue = new LinkedBlockingQueue<>(queueSize <= 0 ? Integer.MAX_VALUE : queueSize);
    }

    /**
     * Construct a new instance. The maximum number of concurrent requests must be at least one.
     *
     * @param maximumConcurrentRequests the maximum concurrent requests
     * @param queueSize                 The maximum number of requests to queue
     */
    public RequestLimit(int maximumConcurrentRequests, int queueSize) {
        if (maximumConcurrentRequests < 1) {
            throw new IllegalArgumentException("Maximum concurrent requests must be at least 1");
        }
        state = (maximumConcurrentRequests & 0xFFFFFFFFL) << 32;

        this.queue = new LinkedBlockingQueue<SuspendedRequest>(queueSize <= 0 ? Integer.MAX_VALUE : queueSize);
    }

Replace Generic With Diamond LinkedBlockingQueue<SuspendedRequest> with LinkedBlockingQueue<> in method public RequestLimit(maximumConcurrentRequests int, queueSize int) from class io.undertow.server.handlers.RequestLimit


    public DefaultAccessLogReceiver(final Executor logWriteExecutor, final File outputDirectory, final String logBaseName, final String logNameSuffix) {
        this.logWriteExecutor = logWriteExecutor;
        this.outputDirectory = outputDirectory;
        this.logBaseName = logBaseName;
        this.logNameSuffix = (logNameSuffix != null) ? logNameSuffix : DEFAULT_LOG_SUFFIX;
        this.pendingMessages = new ConcurrentLinkedDeque<>();
        this.defaultLogFile = new File(outputDirectory, logBaseName + this.logNameSuffix);
        calculateChangeOverPoint();
    }

    public DefaultAccessLogReceiver(final Executor logWriteExecutor, final File outputDirectory, final String logBaseName, final String logNameSuffix) {
        this.logWriteExecutor = logWriteExecutor;
        this.outputDirectory = outputDirectory;
        this.logBaseName = logBaseName;
        this.logNameSuffix = (logNameSuffix != null) ? logNameSuffix : DEFAULT_LOG_SUFFIX;
        this.pendingMessages = new ConcurrentLinkedDeque<String>();
        this.defaultLogFile = new File(outputDirectory, logBaseName + this.logNameSuffix);
        calculateChangeOverPoint();
    }

Replace Generic With Diamond ConcurrentLinkedDeque<String> with ConcurrentLinkedDeque<> in method public DefaultAccessLogReceiver(logWriteExecutor Executor, outputDirectory File, logBaseName String, logNameSuffix String) from class io.undertow.server.handlers.accesslog.DefaultAccessLogReceiver


    /**
     * processes all queued log messages
     */
    @Override
    public void run() {
        if (!stateUpdater.compareAndSet(this, 1, 2)) {
            return;
        }
        if (forceLogRotation) {
            doRotate();
        }
        List<String> messages = new ArrayList<>();
        String msg = null;
        //only grab at most 1000 messages at a time
        for (int i = 0; i < 1000; ++i) {
            msg = pendingMessages.poll();
            if (msg == null) {
                break;
            }
            messages.add(msg);
        }
        try {
            if (!messages.isEmpty()) {
                writeMessage(messages);
            }
        } finally {
            stateUpdater.set(this, 0);
            //check to see if there is still more messages
            //if so then run this again
            if (!pendingMessages.isEmpty() || forceLogRotation) {
                if (stateUpdater.compareAndSet(this, 0, 1)) {
                    logWriteExecutor.execute(this);
                }
            }
        }
    }

    /**
     * processes all queued log messages
     */
    @Override
    public void run() {
        if (!stateUpdater.compareAndSet(this, 1, 2)) {
            return;
        }
        if (forceLogRotation) {
            doRotate();
        }
        List<String> messages = new ArrayList<String>();
        String msg = null;
        //only grab at most 1000 messages at a time
        for (int i = 0; i < 1000; ++i) {
            msg = pendingMessages.poll();
            if (msg == null) {
                break;
            }
            messages.add(msg);
        }
        try {
            if (!messages.isEmpty()) {
                writeMessage(messages);
            }
        } finally {
            stateUpdater.set(this, 0);
            //check to see if there is still more messages
            //if so then run this again
            if (!pendingMessages.isEmpty() || forceLogRotation) {
                if (stateUpdater.compareAndSet(this, 0, 1)) {
                    logWriteExecutor.execute(this);
                }
            }
        }
    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public run() : void from class io.undertow.server.handlers.accesslog.DefaultAccessLogReceiver


    private static Map<String, HandlerBuilder> loadBuilders(final ClassLoader classLoader) {
        ServiceLoader<HandlerBuilder> loader = ServiceLoader.load(HandlerBuilder.class, classLoader);
        final Map<String, HandlerBuilder> ret = new HashMap<>();
        for (HandlerBuilder builder : loader) {
            if (ret.containsKey(builder.name())) {
                if (ret.get(builder.name()).getClass() != builder.getClass()) {
                    throw UndertowMessages.MESSAGES.moreThanOneHandlerWithName(builder.name(), builder.getClass(), ret.get(builder.name()).getClass());
                }
            } else {
                ret.put(builder.name(), builder);
            }
        }
        return ret;
    }

    private static Map<String, HandlerBuilder> loadBuilders(final ClassLoader classLoader) {
        ServiceLoader<HandlerBuilder> loader = ServiceLoader.load(HandlerBuilder.class, classLoader);
        final Map<String, HandlerBuilder> ret = new HashMap<String, HandlerBuilder>();
        for (HandlerBuilder builder : loader) {
            if (ret.containsKey(builder.name())) {
                if (ret.get(builder.name()).getClass() != builder.getClass()) {
                    throw UndertowMessages.MESSAGES.moreThanOneHandlerWithName(builder.name(), builder.getClass(), ret.get(builder.name()).getClass());
                }
            } else {
                ret.put(builder.name(), builder);
            }
        }
        return ret;
    }

Replace Generic With Diamond HashMap<String,HandlerBuilder> with HashMap<> in method private loadBuilders(classLoader ClassLoader) : Map<String,HandlerBuilder> from class io.undertow.server.handlers.builder.HandlerParser


    private static HandlerWrapper parseBuilder(final String string, final Token token, final Deque<Token> tokens, final Map<String, HandlerBuilder> builders, final ExchangeAttributeParser attributeParser) {
        HandlerBuilder builder = builders.get(token.token);
        if (builder == null) {
            throw error(string, token.position, "no predicate named " + token.token);
        }
        Token next = tokens.peek();
        if (next.token.equals("[")) {
            final Map<String, Object> values = new HashMap<>();

            tokens.poll();
            next = tokens.poll();
            if (next == null) {
                throw error(string, string.length(), "Unexpected end of input");
            }
            if (next.token.equals("{")) {
                return handleSingleArrayValue(string, builder, tokens, next, attributeParser);
            }
            while (!next.token.equals("]")) {
                Token equals = tokens.poll();
                if (!equals.token.equals("=")) {
                    if (equals.token.equals("]") && values.isEmpty()) {
                        //single value case
                        return handleSingleValue(string, builder, next, attributeParser);
                    } else if (equals.token.equals(",")) {
                        tokens.push(equals);
                        tokens.push(next);
                        return handleSingleVarArgsValue(string, builder, tokens, next, attributeParser);
                    }
                    throw error(string, equals.position, "Unexpected token");
                }
                Token value = tokens.poll();
                if (value == null) {
                    throw error(string, string.length(), "Unexpected end of input");
                }
                if (value.token.equals("{")) {
                    values.put(next.token, readArrayType(string, tokens, next, builder, attributeParser, "}"));
                } else {
                    if (isOperator(value.token) || isSpecialChar(value.token)) {
                        throw error(string, value.position, "Unexpected token");
                    }

                    Class<?> type = builder.parameters().get(next.token);
                    if (type == null) {
                        throw error(string, next.position, "Unexpected parameter " + next.token);
                    }
                    values.put(next.token, coerceToType(string, value, type, attributeParser));
                }

                next = tokens.poll();
                if (next == null) {
                    throw error(string, string.length(), "Unexpected end of input");
                }
                if (!next.token.equals("]")) {
                    if (!next.token.equals(",")) {
                        throw error(string, string.length(), "Expecting , or ]");
                    }
                    next = tokens.poll();
                    if (next == null) {
                        throw error(string, string.length(), "Unexpected end of input");
                    }
                }
            }
            checkParameters(string, next.position, values, builder);
            return builder.build(values);

        } else {
            throw error(string, next.position, "Unexpected character");
        }
    }

    private static HandlerWrapper parseBuilder(final String string, final Token token, final Deque<Token> tokens, final Map<String, HandlerBuilder> builders, final ExchangeAttributeParser attributeParser) {
        HandlerBuilder builder = builders.get(token.token);
        if (builder == null) {
            throw error(string, token.position, "no predicate named " + token.token);
        }
        Token next = tokens.peek();
        if (next.token.equals("[")) {
            final Map<String, Object> values = new HashMap<String, Object>();

            tokens.poll();
            next = tokens.poll();
            if (next == null) {
                throw error(string, string.length(), "Unexpected end of input");
            }
            if (next.token.equals("{")) {
                return handleSingleArrayValue(string, builder, tokens, next, attributeParser);
            }
            while (!next.token.equals("]")) {
                Token equals = tokens.poll();
                if (!equals.token.equals("=")) {
                    if (equals.token.equals("]") && values.isEmpty()) {
                        //single value case
                        return handleSingleValue(string, builder, next, attributeParser);
                    } else if (equals.token.equals(",")) {
                        tokens.push(equals);
                        tokens.push(next);
                        return handleSingleVarArgsValue(string, builder, tokens, next, attributeParser);
                    }
                    throw error(string, equals.position, "Unexpected token");
                }
                Token value = tokens.poll();
                if (value == null) {
                    throw error(string, string.length(), "Unexpected end of input");
                }
                if (value.token.equals("{")) {
                    values.put(next.token, readArrayType(string, tokens, next, builder, attributeParser, "}"));
                } else {
                    if (isOperator(value.token) || isSpecialChar(value.token)) {
                        throw error(string, value.position, "Unexpected token");
                    }

                    Class<?> type = builder.parameters().get(next.token);
                    if (type == null) {
                        throw error(string, next.position, "Unexpected parameter " + next.token);
                    }
                    values.put(next.token, coerceToType(string, value, type, attributeParser));
                }

                next = tokens.poll();
                if (next == null) {
                    throw error(string, string.length(), "Unexpected end of input");
                }
                if (!next.token.equals("]")) {
                    if (!next.token.equals(",")) {
                        throw error(string, string.length(), "Expecting , or ]");
                    }
                    next = tokens.poll();
                    if (next == null) {
                        throw error(string, string.length(), "Unexpected end of input");
                    }
                }
            }
            checkParameters(string, next.position, values, builder);
            return builder.build(values);

        } else {
            throw error(string, next.position, "Unexpected character");
        }
    }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method private parseBuilder(string String, token Token, tokens Deque<Token>, builders Map<String,HandlerBuilder>, attributeParser ExchangeAttributeParser) : HandlerWrapper from class io.undertow.server.handlers.builder.HandlerParser


    private static Object readArrayType(final String string, final Deque<Token> tokens, Token paramName, HandlerBuilder builder, final ExchangeAttributeParser attributeParser, String expectedEndToken) {
        Class<?> type = builder.parameters().get(paramName.token);
        if (type == null) {
            throw error(string, paramName.position, "no parameter called " + paramName.token);
        } else if (!type.isArray()) {
            throw error(string, paramName.position, "parameter is not an array type " + paramName.token);
        }

        Class<?> componentType = type.getComponentType();
        final List<Object> values = new ArrayList<>();
        Token token = tokens.poll();
        while (token != null) {
            Token commaOrEnd = tokens.poll();
            values.add(coerceToType(string, token, componentType, attributeParser));
            if (commaOrEnd.token.equals(expectedEndToken)) {
                Object array = Array.newInstance(componentType, values.size());
                for (int i = 0; i < values.size(); ++i) {
                    Array.set(array, i, values.get(i));
                }
                return array;
            } else if (!commaOrEnd.token.equals(",")) {
                throw error(string, commaOrEnd.position, "expected either , or }");
            }
            token = tokens.poll();
        }
        throw error(string, string.length(), "unexpected end of input in array");
    }

    private static Object readArrayType(final String string, final Deque<Token> tokens, Token paramName, HandlerBuilder builder, final ExchangeAttributeParser attributeParser, String expectedEndToken) {
        Class<?> type = builder.parameters().get(paramName.token);
        if (type == null) {
            throw error(string, paramName.position, "no parameter called " + paramName.token);
        } else if (!type.isArray()) {
            throw error(string, paramName.position, "parameter is not an array type " + paramName.token);
        }

        Class<?> componentType = type.getComponentType();
        final List<Object> values = new ArrayList<Object>();
        Token token = tokens.poll();
        while (token != null) {
            Token commaOrEnd = tokens.poll();
            values.add(coerceToType(string, token, componentType, attributeParser));
            if (commaOrEnd.token.equals(expectedEndToken)) {
                Object array = Array.newInstance(componentType, values.size());
                for (int i = 0; i < values.size(); ++i) {
                    Array.set(array, i, values.get(i));
                }
                return array;
            } else if (!commaOrEnd.token.equals(",")) {
                throw error(string, commaOrEnd.position, "expected either , or }");
            }
            token = tokens.poll();
        }
        throw error(string, string.length(), "unexpected end of input in array");
    }

Replace Generic With Diamond ArrayList<Object> with ArrayList<> in method private readArrayType(string String, tokens Deque<Token>, paramName Token, builder HandlerBuilder, attributeParser ExchangeAttributeParser, expectedEndToken String) : Object from class io.undertow.server.handlers.builder.HandlerParser


    private static void checkParameters(final String string, int pos, final Map<String, Object> values, final HandlerBuilder builder) {
        final Set<String> required = new HashSet<>(builder.requiredParameters());
        for (String key : values.keySet()) {
            required.remove(key);
        }
        if (!required.isEmpty()) {
            throw error(string, pos, "Missing required parameters " + required);
        }
    }

    private static void checkParameters(final String string, int pos, final Map<String, Object> values, final HandlerBuilder builder) {
        final Set<String> required = new HashSet<String>(builder.requiredParameters());
        for (String key : values.keySet()) {
            required.remove(key);
        }
        if (!required.isEmpty()) {
            throw error(string, pos, "Missing required parameters " + required);
        }
    }

Replace Generic With Diamond HashSet<String> with HashSet<> in method private checkParameters(string String, pos int, values Map<String,Object>, builder HandlerBuilder) : void from class io.undertow.server.handlers.builder.HandlerParser


    public static List<PredicatedHandler> parse(final String contents, final ClassLoader classLoader) {
        String[] lines = contents.split("\\n");
        final List<PredicatedHandler> wrappers = new ArrayList<>();

        for (String line : lines) {
            if (line.trim().length() > 0) {
                Predicate predicate;
                HandlerWrapper handler;
                String[] parts = line.split("->");
                if (parts.length == 2) {
                    predicate = PredicateParser.parse(parts[0], classLoader);
                    handler = HandlerParser.parse(parts[1], classLoader);
                } else if (parts.length == 1) {
                    predicate = Predicates.truePredicate();
                    handler = HandlerParser.parse(parts[0], classLoader);
                } else {
                    throw UndertowMessages.MESSAGES.invalidSyntax(line);
                }
                wrappers.add(new PredicatedHandler(predicate, handler));
            }
        }
        return wrappers;
    }

    public static List<PredicatedHandler> parse(final String contents, final ClassLoader classLoader) {
        String[] lines = contents.split("\\n");
        final List<PredicatedHandler> wrappers = new ArrayList<PredicatedHandler>();

        for (String line : lines) {
            if (line.trim().length() > 0) {
                Predicate predicate;
                HandlerWrapper handler;
                String[] parts = line.split("->");
                if (parts.length == 2) {
                    predicate = PredicateParser.parse(parts[0], classLoader);
                    handler = HandlerParser.parse(parts[1], classLoader);
                } else if (parts.length == 1) {
                    predicate = Predicates.truePredicate();
                    handler = HandlerParser.parse(parts[0], classLoader);
                } else {
                    throw UndertowMessages.MESSAGES.invalidSyntax(line);
                }
                wrappers.add(new PredicatedHandler(predicate, handler));
            }
        }
        return wrappers;
    }

Replace Generic With Diamond ArrayList<PredicatedHandler> with ArrayList<> in method public parse(contents String, classLoader ClassLoader) : List<PredicatedHandler> from class io.undertow.server.handlers.builder.PredicatedHandlersParser


    @Override
    public Map<String, Class<?>> parameters() {
        Map<String, Class<?>> parameters = new HashMap<>();
        parameters.put("value", Integer.class);
        return parameters;
    }

    @Override
    public Map<String, Class<?>> parameters() {
        Map<String, Class<?>> parameters = new HashMap<String, Class<?>>();
        parameters.put("value", Integer.class);
        return parameters;
    }

Replace Generic With Diamond HashMap<String,Class<?>> with HashMap<> in method public parameters() : Map<String,Class<?>> from class io.undertow.server.handlers.builder.ResponseCodeHandlerBuilder


    @Override
    public Set<String> requiredParameters() {
        final Set<String> req = new HashSet<>();
        req.add("value");
        return req;
    }

    @Override
    public Set<String> requiredParameters() {
        final Set<String> req = new HashSet<String>();
        req.add("value");
        return req;
    }

Replace Generic With Diamond HashSet<String> with HashSet<> in method public requiredParameters() : Set<String> from class io.undertow.server.handlers.builder.ResponseCodeHandlerBuilder


    @Override
    public Map<String, Class<?>> parameters() {
        Map<String, Class<?>> parameters = new HashMap<>();
        parameters.put("value", ExchangeAttribute.class);
        parameters.put("attribute", ExchangeAttribute.class);

        return parameters;
    }

    @Override
    public Map<String, Class<?>> parameters() {
        Map<String, Class<?>> parameters = new HashMap<String, Class<?>>();
        parameters.put("value", ExchangeAttribute.class);
        parameters.put("attribute", ExchangeAttribute.class);

        return parameters;
    }

Replace Generic With Diamond HashMap<String,Class<?>> with HashMap<> in method public parameters() : Map<String,Class<?>> from class io.undertow.server.handlers.builder.SetHandlerBuilder


    @Override
    public Set<String> requiredParameters() {
        final Set<String> req = new HashSet<>();
        req.add("value");
        req.add("attribute");
        return req;
    }

    @Override
    public Set<String> requiredParameters() {
        final Set<String> req = new HashSet<String>();
        req.add("value");
        req.add("attribute");
        return req;
    }

Replace Generic With Diamond HashSet<String> with HashSet<> in method public requiredParameters() : Set<String> from class io.undertow.server.handlers.builder.SetHandlerBuilder


    public DirectBufferCache(int sliceSize, int slicesPerPage, int maxMemory, final BufferAllocator<ByteBuffer> bufferAllocator, int maxAge) {
        this.sliceSize = sliceSize;
        this.pool = new LimitedBufferSlicePool(bufferAllocator, sliceSize, sliceSize * slicesPerPage, maxMemory / (sliceSize * slicesPerPage));
        this.cache = new ConcurrentHashMap<>(16);
        this.accessQueue = ConcurrentDirectDeque.newInstance();
        this.maxAge = maxAge;
    }

    public DirectBufferCache(int sliceSize, int slicesPerPage, int maxMemory, final BufferAllocator<ByteBuffer> bufferAllocator, int maxAge) {
        this.sliceSize = sliceSize;
        this.pool = new LimitedBufferSlicePool(bufferAllocator, sliceSize, sliceSize * slicesPerPage, maxMemory / (sliceSize * slicesPerPage));
        this.cache = new ConcurrentHashMap<Object, CacheEntry>(16);
        this.accessQueue = ConcurrentDirectDeque.newInstance();
        this.maxAge = maxAge;
    }

Replace Generic With Diamond ConcurrentHashMap<Object,CacheEntry> with ConcurrentHashMap<> in method public DirectBufferCache(sliceSize int, slicesPerPage int, maxMemory int, bufferAllocator BufferAllocator<ByteBuffer>, maxAge int) from class io.undertow.server.handlers.cache.DirectBufferCache


    /**
     * Returns a set of all the keys in the cache. This is a copy of the
     * key set at the time of method invocation.
     *
     * @return all the keys in this cache
     */
    public Set<Object> getAllKeys() {
        return new HashSet<>(cache.keySet());
    }

    /**
     * Returns a set of all the keys in the cache. This is a copy of the
     * key set at the time of method invocation.
     *
     * @return all the keys in this cache
     */
    public Set<Object> getAllKeys() {
        return new HashSet<Object>(cache.keySet());
    }

Replace Generic With Diamond HashSet<Object> with HashSet<> in method public getAllKeys() : Set<Object> from class io.undertow.server.handlers.cache.DirectBufferCache


    public LRUCache(int maxEntries, final int maxAge) {
        this.maxAge = maxAge;
        this.cache = new ConcurrentHashMap<>(16);
        this.accessQueue = ConcurrentDirectDeque.newInstance();
        this.maxEntries = maxEntries;
    }

    public LRUCache(int maxEntries, final int maxAge) {
        this.maxAge = maxAge;
        this.cache = new ConcurrentHashMap<K, CacheEntry<K, V>>(16);
        this.accessQueue = ConcurrentDirectDeque.newInstance();
        this.maxEntries = maxEntries;
    }

Replace Generic With Diamond ConcurrentHashMap<K,CacheEntry<K,V>> with ConcurrentHashMap<> in method public LRUCache(maxEntries int, maxAge int) from class io.undertow.server.handlers.cache.LRUCache


    public void add(K key, V newValue) {
        CacheEntry<K, V> value = cache.get(key);
        if (value == null) {
            long expires;
            if(maxAge == -1) {
                expires = -1;
            } else {
                expires = System.currentTimeMillis() + maxAge;
            }
            value = new CacheEntry<>(key, newValue, expires);
            CacheEntry result = cache.putIfAbsent(key, value);
            if (result != null) {
                value = result;
                value.setValue(newValue);
            }
            bumpAccess(value);
            if (cache.size() > maxEntries) {
                //remove the oldest
                CacheEntry<K, V> oldest = accessQueue.poll();
                if (oldest != value) {
                    this.remove(oldest.key());
                }
            }
        }
    }

    public void add(K key, V newValue) {
        CacheEntry<K, V> value = cache.get(key);
        if (value == null) {
            long expires;
            if(maxAge == -1) {
                expires = -1;
            } else {
                expires = System.currentTimeMillis() + maxAge;
            }
            value = new CacheEntry<K, V>(key, newValue, expires);
            CacheEntry result = cache.putIfAbsent(key, value);
            if (result != null) {
                value = result;
                value.setValue(newValue);
            }
            bumpAccess(value);
            if (cache.size() > maxEntries) {
                //remove the oldest
                CacheEntry<K, V> oldest = accessQueue.poll();
                if (oldest != value) {
                    this.remove(oldest.key());
                }
            }
        }
    }

Replace Generic With Diamond CacheEntry<K,V> with CacheEntry<> in method public add(key K, newValue V) : void from class io.undertow.server.handlers.cache.LRUCache


    public FileErrorPageHandler(final File file, final Integer... responseCodes) {
        this.file = file;
        this.responseCodes = new HashSet<>(Arrays.asList(responseCodes));
    }

    public FileErrorPageHandler(final File file, final Integer... responseCodes) {
        this.file = file;
        this.responseCodes = new HashSet<Integer>(Arrays.asList(responseCodes));
    }

Replace Generic With Diamond HashSet<Integer> with HashSet<> in method public FileErrorPageHandler(file File, responseCodes Integer...) from class io.undertow.server.handlers.error.FileErrorPageHandler


    public FileErrorPageHandler setResponseCodes(final Set<Integer> responseCodes) {
        if (responseCodes == null) {
            this.responseCodes = Collections.emptySet();
        } else {
            this.responseCodes = new HashSet<>(responseCodes);
        }
        return this;
    }

    public FileErrorPageHandler setResponseCodes(final Set<Integer> responseCodes) {
        if (responseCodes == null) {
            this.responseCodes = Collections.emptySet();
        } else {
            this.responseCodes = new HashSet<Integer>(responseCodes);
        }
        return this;
    }

Replace Generic With Diamond HashSet<Integer> with HashSet<> in method public setResponseCodes(responseCodes Set<Integer>) : FileErrorPageHandler from class io.undertow.server.handlers.error.FileErrorPageHandler


    public FileErrorPageHandler setResponseCodes(final Integer... responseCodes) {
        this.responseCodes = new HashSet<>(Arrays.asList(responseCodes));
        return this;
    }

    public FileErrorPageHandler setResponseCodes(final Integer... responseCodes) {
        this.responseCodes = new HashSet<Integer>(Arrays.asList(responseCodes));
        return this;
    }

Replace Generic With Diamond HashSet<Integer> with HashSet<> in method public setResponseCodes(responseCodes Integer...) : FileErrorPageHandler from class io.undertow.server.handlers.error.FileErrorPageHandler


    public SimpleErrorPageHandler setResponseCodes(final Set<Integer> responseCodes) {
        this.responseCodes = new HashSet<>(responseCodes);
        return this;
    }

    public SimpleErrorPageHandler setResponseCodes(final Set<Integer> responseCodes) {
        this.responseCodes = new HashSet<Integer>(responseCodes);
        return this;
    }

Replace Generic With Diamond HashSet<Integer> with HashSet<> in method public setResponseCodes(responseCodes Set<Integer>) : SimpleErrorPageHandler from class io.undertow.server.handlers.error.SimpleErrorPageHandler


    public SimpleErrorPageHandler setResponseCodes(final Integer... responseCodes) {
        this.responseCodes = new HashSet<>(Arrays.asList(responseCodes));
        return this;
    }

    public SimpleErrorPageHandler setResponseCodes(final Integer... responseCodes) {
        this.responseCodes = new HashSet<Integer>(Arrays.asList(responseCodes));
        return this;
    }

Replace Generic With Diamond HashSet<Integer> with HashSet<> in method public setResponseCodes(responseCodes Integer...) : SimpleErrorPageHandler from class io.undertow.server.handlers.error.SimpleErrorPageHandler


    public void add(String name, String value, final HeaderMap headers) {
        Deque<FormValue> values = this.values.get(name);
        if (values == null) {
            this.values.put(name, values = new ArrayDeque<>(1));
        }
        values.add(new FormValueImpl(value, headers));
        if (++valueCount > maxValues) {
            throw UndertowMessages.MESSAGES.tooManyParameters(maxValues);
        }
    }

    public void add(String name, String value, final HeaderMap headers) {
        Deque<FormValue> values = this.values.get(name);
        if (values == null) {
            this.values.put(name, values = new ArrayDeque<FormValue>(1));
        }
        values.add(new FormValueImpl(value, headers));
        if (++valueCount > maxValues) {
            throw UndertowMessages.MESSAGES.tooManyParameters(maxValues);
        }
    }

Replace Generic With Diamond ArrayDeque<FormValue> with ArrayDeque<> in method public add(name String, value String, headers HeaderMap) : void from class io.undertow.server.handlers.form.FormData


    public void add(String name, File value, String fileName, final HeaderMap headers) {
        Deque<FormValue> values = this.values.get(name);
        if (values == null) {
            this.values.put(name, values = new ArrayDeque<>(1));
        }
        values.add(new FormValueImpl(value, fileName, headers));
        if (values.size() > maxValues) {
            throw UndertowMessages.MESSAGES.tooManyParameters(maxValues);
        }
        if (++valueCount > maxValues) {
            throw UndertowMessages.MESSAGES.tooManyParameters(maxValues);
        }
    }

    public void add(String name, File value, String fileName, final HeaderMap headers) {
        Deque<FormValue> values = this.values.get(name);
        if (values == null) {
            this.values.put(name, values = new ArrayDeque<FormValue>(1));
        }
        values.add(new FormValueImpl(value, fileName, headers));
        if (values.size() > maxValues) {
            throw UndertowMessages.MESSAGES.tooManyParameters(maxValues);
        }
        if (++valueCount > maxValues) {
            throw UndertowMessages.MESSAGES.tooManyParameters(maxValues);
        }
    }

Replace Generic With Diamond ArrayDeque<FormValue> with ArrayDeque<> in method public add(name String, value File, fileName String, headers HeaderMap) : void from class io.undertow.server.handlers.form.FormData


    public void put(String name, String value, final HeaderMap headers) {
        Deque<FormValue> values = new ArrayDeque<>(1);
        Deque<FormValue> old = this.values.put(name, values);
        if (old != null) {
            valueCount -= old.size();
        }
        values.add(new FormValueImpl(value, headers));

        if (++valueCount > maxValues) {
            throw UndertowMessages.MESSAGES.tooManyParameters(maxValues);
        }
    }

    public void put(String name, String value, final HeaderMap headers) {
        Deque<FormValue> values = new ArrayDeque<FormValue>(1);
        Deque<FormValue> old = this.values.put(name, values);
        if (old != null) {
            valueCount -= old.size();
        }
        values.add(new FormValueImpl(value, headers));

        if (++valueCount > maxValues) {
            throw UndertowMessages.MESSAGES.tooManyParameters(maxValues);
        }
    }

Replace Generic With Diamond ArrayDeque<FormValue> with ArrayDeque<> in method public put(name String, value String, headers HeaderMap) : void from class io.undertow.server.handlers.form.FormData


        @Override
        public void close() throws IOException {
            //we have to dispatch this, as it may result in file IO
            final List<File> files = new ArrayList<>(getCreatedFiles());
            exchange.getConnection().getWorker().execute(new Runnable() {
                @Override
                public void run() {
                    for (final File file : files) {
                        if (file.exists()) {
                            if (!file.delete()) {
                                UndertowLogger.REQUEST_LOGGER.cannotRemoveUploadedFile(file);
                            }
                        }
                    }
                }
            });

        }

        @Override
        public void close() throws IOException {
            //we have to dispatch this, as it may result in file IO
            final List<File> files = new ArrayList<File>(getCreatedFiles());
            exchange.getConnection().getWorker().execute(new Runnable() {
                @Override
                public void run() {
                    for (final File file : files) {
                        if (file.exists()) {
                            if (!file.delete()) {
                                UndertowLogger.REQUEST_LOGGER.cannotRemoveUploadedFile(file);
                            }
                        }
                    }
                }
            });

        }

Replace Generic With Diamond ArrayList<File> with ArrayList<> in method public close() : void from class io.undertow.server.handlers.form.MultiPartParserDefinition.MultiPartUploadHandler


    private void processDomainCmd(HttpServerExchange exchange, String domain, Status status) throws Exception {
        for (Node nodeConfig : container.getNodes()) {
            if (nodeConfig.getNodeConfig().getDomain().equals(domain)) {
                Map<String, String[]> params = new HashMap<>();
                String[] values = new String[1];
                values[0] = nodeConfig.getJvmRoute();
                params.put("JVMRoute", values);
                processNodeCmd(exchange, params, status);
            }
        }
    }

    private void processDomainCmd(HttpServerExchange exchange, String domain, Status status) throws Exception {
        for (Node nodeConfig : container.getNodes()) {
            if (nodeConfig.getNodeConfig().getDomain().equals(domain)) {
                Map<String, String[]> params = new HashMap<String, String[]>();
                String[] values = new String[1];
                values[0] = nodeConfig.getJvmRoute();
                params.put("JVMRoute", values);
                processNodeCmd(exchange, params, status);
            }
        }
    }

Replace Generic With Diamond HashMap<String,String[]> with HashMap<> in method private processDomainCmd(exchange HttpServerExchange, domain String, status Status) : void from class io.undertow.server.handlers.proxy.mod_cluster.MCMPHandler


    private Map<String, String[]> buildMap(Map<String, Deque<String>> params) {
        Map<String, String[]> sparams = new HashMap<>();
        for (String key : params.keySet()) {
            // In fact we only have one
            String[] values = new String[1];
            values[0] = params.get(key).getFirst();
            sparams.put(key, values);
        }
        return sparams;
    }

    private Map<String, String[]> buildMap(Map<String, Deque<String>> params) {
        Map<String, String[]> sparams = new HashMap<String, String[]>();
        for (String key : params.keySet()) {
            // In fact we only have one
            String[] values = new String[1];
            values[0] = params.get(key).getFirst();
            sparams.put(key, values);
        }
        return sparams;
    }

Replace Generic With Diamond HashMap<String,String[]> with HashMap<> in method private buildMap(params Map<String,Deque<String>>) : Map<String,String[]> from class io.undertow.server.handlers.proxy.mod_cluster.MCMPHandler


    private Map<String, String[]> readPostParameters(HttpServerExchange exchange) throws IOException {
        final Map<String, String[]> ret = new HashMap<>();
        FormDataParser parser = FormParserFactory.builder(false).addParser(new FormEncodedDataDefinition().setForceCreation(true)).build().createParser(exchange);

        FormData formData = parser.parseBlocking();
        Iterator<String> it = formData.iterator();
        while (it.hasNext()) {
            final String name = it.next();
            Deque<FormData.FormValue> val = formData.get(name);
            if (ret.containsKey(name)) {
                String[] existing = ret.get(name);
                String[] array = new String[val.size() + existing.length];
                System.arraycopy(existing, 0, array, 0, existing.length);
                int i = existing.length;
                for (final FormData.FormValue v : val) {
                    array[i++] = v.getValue();
                }
                ret.put(name, array);
            } else {
                String[] array = new String[val.size()];
                int i = 0;
                for (final FormData.FormValue v : val) {
                    array[i++] = v.getValue();
                }
                ret.put(name, array);
            }
        }
        return ret;
    }

    private Map<String, String[]> readPostParameters(HttpServerExchange exchange) throws IOException {
        final Map<String, String[]> ret = new HashMap<String, String[]>();
        FormDataParser parser = FormParserFactory.builder(false).addParser(new FormEncodedDataDefinition().setForceCreation(true)).build().createParser(exchange);

        FormData formData = parser.parseBlocking();
        Iterator<String> it = formData.iterator();
        while (it.hasNext()) {
            final String name = it.next();
            Deque<FormData.FormValue> val = formData.get(name);
            if (ret.containsKey(name)) {
                String[] existing = ret.get(name);
                String[] array = new String[val.size() + existing.length];
                System.arraycopy(existing, 0, array, 0, existing.length);
                int i = existing.length;
                for (final FormData.FormValue v : val) {
                    array[i++] = v.getValue();
                }
                ret.put(name, array);
            } else {
                String[] array = new String[val.size()];
                int i = 0;
                for (final FormData.FormValue v : val) {
                    array[i++] = v.getValue();
                }
                ret.put(name, array);
            }
        }
        return ret;
    }

Replace Generic With Diamond HashMap<String,String[]> with HashMap<> in method private readPostParameters(exchange HttpServerExchange) : Map<String,String[]> from class io.undertow.server.handlers.proxy.mod_cluster.MCMPHandler


        @Override
        public void run() {
            List<Node> tmp = new ArrayList<>();
            if (failedNodes.isEmpty()) {
                return;
            }
            UndertowLogger.ROOT_LOGGER.debug("Starting health check for previously failed nodes");
            for (Node nodeConfig : failedNodes) {
                if (checkHealth(nodeConfig)) {
                    nodeConfig.getNodeState().setStatus(NodeState.NodeStatus.NODE_UP);
                    tmp.add(nodeConfig);
                }
            }

            if (tmp.isEmpty()) {
                return;
            }

            nodes.addAll(tmp);

            failedNodes.removeAll(tmp);

        }

        @Override
        public void run() {
            List<Node> tmp = new ArrayList<Node>();
            if (failedNodes.isEmpty()) {
                return;
            }
            UndertowLogger.ROOT_LOGGER.debug("Starting health check for previously failed nodes");
            for (Node nodeConfig : failedNodes) {
                if (checkHealth(nodeConfig)) {
                    nodeConfig.getNodeState().setStatus(NodeState.NodeStatus.NODE_UP);
                    tmp.add(nodeConfig);
                }
            }

            if (tmp.isEmpty()) {
                return;
            }

            nodes.addAll(tmp);

            failedNodes.removeAll(tmp);

        }

Replace Generic With Diamond ArrayList<Node> with ArrayList<> in method public run() : void from class io.undertow.server.handlers.proxy.mod_cluster.ModClusterContainer.HealthChecker


        @Override
        public void run() {
            List<Node> tmp = new ArrayList<>();
            try {
                // Retrieve nodes with status "DOWN"
                for (Node n : nodes) {
                    if (n.getNodeState().isNodeDown()) {
                        tmp.add(n);
                    }
                }

                if (tmp.isEmpty()) {
                    return;
                }
                // Remove failed nodes from the list of nodes
                nodes.removeAll(tmp);
                // Add selected nodes to the list of failed nodes
                failedNodes.addAll(tmp);
                tmp.clear();

                // Retrieve nodes with status "UP"
                for (Node n : failedNodes) {
                    if (n.getNodeState().isNodeUp()) {
                        tmp.add(n);
                    }
                }

                if (tmp.isEmpty()) {
                    return;
                }
                // Remove all healthy nodes from the list of failed nodes
                failedNodes.removeAll(tmp);
                // Add selected nodes to the list of healthy nodes
                nodes.addAll(tmp);
                tmp.clear();

                // printNodes();
            } catch (Throwable e) {
                e.printStackTrace();
            }

        }

        @Override
        public void run() {
            List<Node> tmp = new ArrayList<Node>();
            try {
                // Retrieve nodes with status "DOWN"
                for (Node n : nodes) {
                    if (n.getNodeState().isNodeDown()) {
                        tmp.add(n);
                    }
                }

                if (tmp.isEmpty()) {
                    return;
                }
                // Remove failed nodes from the list of nodes
                nodes.removeAll(tmp);
                // Add selected nodes to the list of failed nodes
                failedNodes.addAll(tmp);
                tmp.clear();

                // Retrieve nodes with status "UP"
                for (Node n : failedNodes) {
                    if (n.getNodeState().isNodeUp()) {
                        tmp.add(n);
                    }
                }

                if (tmp.isEmpty()) {
                    return;
                }
                // Remove all healthy nodes from the list of failed nodes
                failedNodes.removeAll(tmp);
                // Add selected nodes to the list of healthy nodes
                nodes.addAll(tmp);
                tmp.clear();

                // printNodes();
            } catch (Throwable e) {
                e.printStackTrace();
            }

        }

Replace Generic With Diamond ArrayList<Node> with ArrayList<> in method public run() : void from class io.undertow.server.handlers.proxy.mod_cluster.ModClusterContainer.NodeStatusChecker


    /**
     * Create a new instance of {@code VirtualHost}
     */
     VHost(VHostBuilder b) {
        this.name = b.name;
        this.JVMRoute = b.JVMRoute;
        this.aliases = Collections.unmodifiableList(new ArrayList<>(b.aliases));
    }

    /**
     * Create a new instance of {@code VirtualHost}
     */
     VHost(VHostBuilder b) {
        this.name = b.name;
        this.JVMRoute = b.JVMRoute;
        this.aliases = Collections.unmodifiableList(new ArrayList<String>(b.aliases));
    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method package VHost(b VHostBuilder) from class io.undertow.server.handlers.proxy.mod_cluster.VHost


    public CachingResourceManager(final int metadataCacheSize, final long maxFileSize, final DirectBufferCache dataCache, final ResourceManager underlyingResourceManager, final int maxAge) {
        this.maxFileSize = maxFileSize;
        this.underlyingResourceManager = underlyingResourceManager;
        this.dataCache = dataCache;
        this.cache = new LRUCache<>(metadataCacheSize, maxAge);
        this.maxAge = maxAge;
        if(underlyingResourceManager.isResourceChangeListenerSupported()) {
            try {
                underlyingResourceManager.registerResourceChangeListener(new ResourceChangeListener() {
                    @Override
                    public void handleChanges(Collection<ResourceChangeEvent> changes) {
                        for(ResourceChangeEvent change : changes) {
                            invalidate(change.getResource());
                        }
                    }
                });
            } catch (Exception e) {
                UndertowLogger.ROOT_LOGGER.couldNotRegisterChangeListener(e);
            }
        }
    }

    public CachingResourceManager(final int metadataCacheSize, final long maxFileSize, final DirectBufferCache dataCache, final ResourceManager underlyingResourceManager, final int maxAge) {
        this.maxFileSize = maxFileSize;
        this.underlyingResourceManager = underlyingResourceManager;
        this.dataCache = dataCache;
        this.cache = new LRUCache<String, Object>(metadataCacheSize, maxAge);
        this.maxAge = maxAge;
        if(underlyingResourceManager.isResourceChangeListenerSupported()) {
            try {
                underlyingResourceManager.registerResourceChangeListener(new ResourceChangeListener() {
                    @Override
                    public void handleChanges(Collection<ResourceChangeEvent> changes) {
                        for(ResourceChangeEvent change : changes) {
                            invalidate(change.getResource());
                        }
                    }
                });
            } catch (Exception e) {
                UndertowLogger.ROOT_LOGGER.couldNotRegisterChangeListener(e);
            }
        }
    }

Replace Generic With Diamond LRUCache<String,Object> with LRUCache<> in method public CachingResourceManager(metadataCacheSize int, maxFileSize long, dataCache DirectBufferCache, underlyingResourceManager ResourceManager, maxAge int) from class io.undertow.server.handlers.resource.CachingResourceManager


    @Override
    public List<Resource> list() {
        final List<Resource> resources = new ArrayList<>();
        for (String child : file.list()) {
            resources.add(new FileResource(new File(this.file, child), manager, path));
        }
        return resources;
    }

    @Override
    public List<Resource> list() {
        final List<Resource> resources = new ArrayList<Resource>();
        for (String child : file.list()) {
            resources.add(new FileResource(new File(this.file, child), manager, path));
        }
        return resources;
    }

Replace Generic With Diamond ArrayList<Resource> with ArrayList<> in method public list() : List<Resource> from class io.undertow.server.handlers.resource.FileResource


                @Override
                public void handleChanges(Collection<FileChangeEvent> changes) {
                    synchronized (FileResourceManager.this) {
                        final List<ResourceChangeEvent> events = new ArrayList<>();
                        for (FileChangeEvent change : changes) {
                            if (change.getFile().getAbsolutePath().startsWith(base)) {
                                String path = change.getFile().getAbsolutePath().substring(base.length());
                                events.add(new ResourceChangeEvent(path, ResourceChangeEvent.Type.valueOf(change.getType().name())));
                            }
                        }
                        for (ResourceChangeListener listener : listeners) {
                            listener.handleChanges(events);
                        }
                    }
                }

                @Override
                public void handleChanges(Collection<FileChangeEvent> changes) {
                    synchronized (FileResourceManager.this) {
                        final List<ResourceChangeEvent> events = new ArrayList<ResourceChangeEvent>();
                        for (FileChangeEvent change : changes) {
                            if (change.getFile().getAbsolutePath().startsWith(base)) {
                                String path = change.getFile().getAbsolutePath().substring(base.length());
                                events.add(new ResourceChangeEvent(path, ResourceChangeEvent.Type.valueOf(change.getType().name())));
                            }
                        }
                        for (ResourceChangeListener listener : listeners) {
                            listener.handleChanges(events);
                        }
                    }
                }

Replace Generic With Diamond ArrayList<ResourceChangeEvent> with ArrayList<> in method public handleChanges(changes Collection<FileChangeEvent>) : void from class io.undertow.server.handlers.resource.FileResourceManager.registerResourceChangeListener.watchPath.new FileChangeCallback


    @Override
    public synchronized void registerResourceChangeListener(ResourceChangeListener listener) {
        listeners.add(listener);
        if (fileSystemWatcher == null) {
            fileSystemWatcher = Xnio.getInstance().createFileSystemWatcher("Watcher for " + base, OptionMap.EMPTY);
            fileSystemWatcher.watchPath(new File(base), new FileChangeCallback() {
                @Override
                public void handleChanges(Collection<FileChangeEvent> changes) {
                    synchronized (FileResourceManager.this) {
                        final List<ResourceChangeEvent> events = new ArrayList<>();
                        for (FileChangeEvent change : changes) {
                            if (change.getFile().getAbsolutePath().startsWith(base)) {
                                String path = change.getFile().getAbsolutePath().substring(base.length());
                                events.add(new ResourceChangeEvent(path, ResourceChangeEvent.Type.valueOf(change.getType().name())));
                            }
                        }
                        for (ResourceChangeListener listener : listeners) {
                            listener.handleChanges(events);
                        }
                    }
                }
            });
        }
    }

    @Override
    public synchronized void registerResourceChangeListener(ResourceChangeListener listener) {
        listeners.add(listener);
        if (fileSystemWatcher == null) {
            fileSystemWatcher = Xnio.getInstance().createFileSystemWatcher("Watcher for " + base, OptionMap.EMPTY);
            fileSystemWatcher.watchPath(new File(base), new FileChangeCallback() {
                @Override
                public void handleChanges(Collection<FileChangeEvent> changes) {
                    synchronized (FileResourceManager.this) {
                        final List<ResourceChangeEvent> events = new ArrayList<ResourceChangeEvent>();
                        for (FileChangeEvent change : changes) {
                            if (change.getFile().getAbsolutePath().startsWith(base)) {
                                String path = change.getFile().getAbsolutePath().substring(base.length());
                                events.add(new ResourceChangeEvent(path, ResourceChangeEvent.Type.valueOf(change.getType().name())));
                            }
                        }
                        for (ResourceChangeListener listener : listeners) {
                            listener.handleChanges(events);
                        }
                    }
                }
            });
        }
    }

Replace Generic With Diamond ArrayList<ResourceChangeEvent> with ArrayList<> in method public registerResourceChangeListener(listener ResourceChangeListener) : void from class io.undertow.server.handlers.resource.FileResourceManager


    @Override
    public List<Resource> list() {
        List<Resource> result = new LinkedList<>();
        File file = getFile();
        try {
            if (file != null) {
                for (File f : file.listFiles()) {
                    result.add(new URLResource(f.toURI().toURL(), connection, f.getPath()));
                }
            }
        } catch (MalformedURLException e) {
            throw new RuntimeException(e);
        }
        return result;
    }

    @Override
    public List<Resource> list() {
        List<Resource> result = new LinkedList<Resource>();
        File file = getFile();
        try {
            if (file != null) {
                for (File f : file.listFiles()) {
                    result.add(new URLResource(f.toURI().toURL(), connection, f.getPath()));
                }
            }
        } catch (MalformedURLException e) {
            throw new RuntimeException(e);
        }
        return result;
    }

Replace Generic With Diamond LinkedList<Resource> with LinkedList<> in method public list() : List<Resource> from class io.undertow.server.handlers.resource.URLResource


    AjpReadListener(final AjpServerConnection connection, final String scheme, AjpRequestParser parser) {
        this.connection = connection;
        this.scheme = scheme;
        this.parser = parser;
        this.maxRequestSize = connection.getUndertowOptions().get(UndertowOptions.MAX_HEADER_SIZE, UndertowOptions.DEFAULT_MAX_HEADER_SIZE);
        this.maxEntitySize = connection.getUndertowOptions().get(UndertowOptions.MAX_ENTITY_SIZE, UndertowOptions.DEFAULT_MAX_ENTITY_SIZE);
        this.writeReadyHandler = new WriteReadyHandler.ChannelListenerHandler<>(connection.getChannel().getSinkChannel());
        this.recordRequestStartTime = connection.getUndertowOptions().get(UndertowOptions.RECORD_REQUEST_START_TIME, false);
    }

    AjpReadListener(final AjpServerConnection connection, final String scheme, AjpRequestParser parser) {
        this.connection = connection;
        this.scheme = scheme;
        this.parser = parser;
        this.maxRequestSize = connection.getUndertowOptions().get(UndertowOptions.MAX_HEADER_SIZE, UndertowOptions.DEFAULT_MAX_HEADER_SIZE);
        this.maxEntitySize = connection.getUndertowOptions().get(UndertowOptions.MAX_ENTITY_SIZE, UndertowOptions.DEFAULT_MAX_ENTITY_SIZE);
        this.writeReadyHandler = new WriteReadyHandler.ChannelListenerHandler<ConduitStreamSinkChannel>(connection.getChannel().getSinkChannel());
        this.recordRequestStartTime = connection.getUndertowOptions().get(UndertowOptions.RECORD_REQUEST_START_TIME, false);
    }

Replace Generic With Diamond WriteReadyHandler.ChannelListenerHandler<ConduitStreamSinkChannel> with WriteReadyHandler.ChannelListenerHandler<> in method package AjpReadListener(connection AjpServerConnection, scheme String, parser AjpRequestParser) from class io.undertow.server.protocol.ajp.AjpReadListener


    public AjpServerConnection(StreamConnection channel, Pool<ByteBuffer> bufferPool, HttpHandler rootHandler, OptionMap undertowOptions, int bufferSize) {
        super(channel, bufferPool, rootHandler, undertowOptions, bufferSize);
        this.writeReadyHandler = new WriteReadyHandler.ChannelListenerHandler<>(channel.getSinkChannel());
    }

    public AjpServerConnection(StreamConnection channel, Pool<ByteBuffer> bufferPool, HttpHandler rootHandler, OptionMap undertowOptions, int bufferSize) {
        super(channel, bufferPool, rootHandler, undertowOptions, bufferSize);
        this.writeReadyHandler = new WriteReadyHandler.ChannelListenerHandler<ConduitStreamSinkChannel>(channel.getSinkChannel());
    }

Replace Generic With Diamond WriteReadyHandler.ChannelListenerHandler<ConduitStreamSinkChannel> with WriteReadyHandler.ChannelListenerHandler<> in method public AjpServerConnection(channel StreamConnection, bufferPool Pool<ByteBuffer>, rootHandler HttpHandler, undertowOptions OptionMap, bufferSize int) from class io.undertow.server.protocol.ajp.AjpServerConnection


    /**
     * receive method, returns null if no frame is ready. Otherwise returns a
     * channel that can be used to read the frame contents.
     * <p/>
     * Calling this method can also have the side effect of making additional data available to
     * existing source channels. In general if you suspend receives or don't have some other way
     * of calling this method then it can prevent frame channels for being fully consumed.
     */
    public synchronized R receive() throws IOException {
        if (receiver != null) {
            return null;
        }
        if (isLastFrameReceived()) {
            //we have received the last frame, we just shut down and return
            //it would probably make more sense to have the last channel responsible for this
            //however it is much simpler just to have it here
            channel.getSourceChannel().suspendReads();
            channel.getSourceChannel().shutdownReads();
            return null;
        }
        ReferenceCountedPooled<ByteBuffer> pooled = this.readData;
        boolean hasData;
        if (pooled == null) {
            Pooled<ByteBuffer> buf = bufferPool.allocate();
            this.readData = pooled = new ReferenceCountedPooled<>(buf, 1);
            hasData = false;
        } else {
            hasData = pooled.getResource().hasRemaining();
        }
        boolean forceFree = false;
        int read = 0;
        try {
            if (!hasData) {
                pooled.getResource().clear();
                read = channel.getSourceChannel().read(pooled.getResource());
                if (read == 0) {
                    //no data, we just free the buffer
                    forceFree = true;
                    return null;
                } else if (read == -1) {
                    try {
                        channel.getSourceChannel().shutdownReads();
                    } catch (IOException e) {
                        if (WebSocketLogger.REQUEST_LOGGER.isDebugEnabled()) {
                            WebSocketLogger.REQUEST_LOGGER.debugf(e, "Connection closed with IOException when attempting to shut down reads");
                        }
                        // nothing we can do here.. close
                        safeClose(channel.getSourceChannel());
                        throw e;
                    }
                    forceFree = true;
                    lastDataRead();
                    return null;
                }
                pooled.getResource().flip();
            }
            FrameHeaderData data = parseFrame(pooled.getResource());
            if (data != null) {
                Pooled<ByteBuffer> frameData;
                if (data.getFrameLength() > pooled.getResource().remaining()) {
                    frameData = pooled.createView(pooled.getResource().duplicate());
                    pooled.getResource().position(pooled.getResource().limit());
                } else {
                    ByteBuffer buf = pooled.getResource().duplicate();
                    buf.limit((int) (buf.position() + data.getFrameLength()));
                    pooled.getResource().position((int) (pooled.getResource().position() + data.getFrameLength()));
                    frameData = pooled.createView(buf);
                }
                AbstractFramedStreamSourceChannel<?, ?, ?> existing = data.getExistingChannel();
                if (existing != null) {
                    if (data.getFrameLength() > frameData.getResource().remaining()) {
                        receiver = (R) existing;
                        if (!receiver.isReadResumed()) {
                            channel.getSourceChannel().suspendReads();
                        }
                    }
                    existing.dataReady(data, frameData);
                    return null;
                } else {
                    boolean moreData = data.getFrameLength() > frameData.getResource().remaining();
                    R newChannel = createChannel(data, frameData);
                    if (moreData) {
                        receiver = newChannel;
                    }
                    receivers.add(newChannel);
                    return newChannel;
                }
            }
            return null;
        } catch (IOException e) {
            //something has code wrong with parsing, close the read side
            //we don't close the write side, as the underlying implementation will most likely want to send an error
            UndertowLogger.REQUEST_LOGGER.ioException(e);
            markReadsBroken(e);
            forceFree = true;
            throw e;
        } finally {
            //if the receive caused the channel to break the close listener may be have been called
            //which will make readData null
            if (readData != null) {
                if (!pooled.getResource().hasRemaining() || forceFree) {
                    pooled.free();
                    this.readData = null;
                }
            }
        }
    }

    /**
     * receive method, returns null if no frame is ready. Otherwise returns a
     * channel that can be used to read the frame contents.
     * <p/>
     * Calling this method can also have the side effect of making additional data available to
     * existing source channels. In general if you suspend receives or don't have some other way
     * of calling this method then it can prevent frame channels for being fully consumed.
     */
    public synchronized R receive() throws IOException {
        if (receiver != null) {
            return null;
        }
        if (isLastFrameReceived()) {
            //we have received the last frame, we just shut down and return
            //it would probably make more sense to have the last channel responsible for this
            //however it is much simpler just to have it here
            channel.getSourceChannel().suspendReads();
            channel.getSourceChannel().shutdownReads();
            return null;
        }
        ReferenceCountedPooled<ByteBuffer> pooled = this.readData;
        boolean hasData;
        if (pooled == null) {
            Pooled<ByteBuffer> buf = bufferPool.allocate();
            this.readData = pooled = new ReferenceCountedPooled<ByteBuffer>(buf, 1);
            hasData = false;
        } else {
            hasData = pooled.getResource().hasRemaining();
        }
        boolean forceFree = false;
        int read = 0;
        try {
            if (!hasData) {
                pooled.getResource().clear();
                read = channel.getSourceChannel().read(pooled.getResource());
                if (read == 0) {
                    //no data, we just free the buffer
                    forceFree = true;
                    return null;
                } else if (read == -1) {
                    try {
                        channel.getSourceChannel().shutdownReads();
                    } catch (IOException e) {
                        if (WebSocketLogger.REQUEST_LOGGER.isDebugEnabled()) {
                            WebSocketLogger.REQUEST_LOGGER.debugf(e, "Connection closed with IOException when attempting to shut down reads");
                        }
                        // nothing we can do here.. close
                        safeClose(channel.getSourceChannel());
                        throw e;
                    }
                    forceFree = true;
                    lastDataRead();
                    return null;
                }
                pooled.getResource().flip();
            }
            FrameHeaderData data = parseFrame(pooled.getResource());
            if (data != null) {
                Pooled<ByteBuffer> frameData;
                if (data.getFrameLength() > pooled.getResource().remaining()) {
                    frameData = pooled.createView(pooled.getResource().duplicate());
                    pooled.getResource().position(pooled.getResource().limit());
                } else {
                    ByteBuffer buf = pooled.getResource().duplicate();
                    buf.limit((int) (buf.position() + data.getFrameLength()));
                    pooled.getResource().position((int) (pooled.getResource().position() + data.getFrameLength()));
                    frameData = pooled.createView(buf);
                }
                AbstractFramedStreamSourceChannel<?, ?, ?> existing = data.getExistingChannel();
                if (existing != null) {
                    if (data.getFrameLength() > frameData.getResource().remaining()) {
                        receiver = (R) existing;
                        if (!receiver.isReadResumed()) {
                            channel.getSourceChannel().suspendReads();
                        }
                    }
                    existing.dataReady(data, frameData);
                    return null;
                } else {
                    boolean moreData = data.getFrameLength() > frameData.getResource().remaining();
                    R newChannel = createChannel(data, frameData);
                    if (moreData) {
                        receiver = newChannel;
                    }
                    receivers.add(newChannel);
                    return newChannel;
                }
            }
            return null;
        } catch (IOException e) {
            //something has code wrong with parsing, close the read side
            //we don't close the write side, as the underlying implementation will most likely want to send an error
            UndertowLogger.REQUEST_LOGGER.ioException(e);
            markReadsBroken(e);
            forceFree = true;
            throw e;
        } finally {
            //if the receive caused the channel to break the close listener may be have been called
            //which will make readData null
            if (readData != null) {
                if (!pooled.getResource().hasRemaining() || forceFree) {
                    pooled.free();
                    this.readData = null;
                }
            }
        }
    }

Replace Generic With Diamond ReferenceCountedPooled<ByteBuffer> with ReferenceCountedPooled<> in method public receive() : R from class io.undertow.server.protocol.framed.AbstractFramedChannel


    /**
     * Pushes back the given data. This should only be used by transfer coding handlers that have read past
     * the end of the request when handling pipelined requests
     *
     * @param unget The buffer to push back
     */
    public void ungetRequestBytes(final Pooled<ByteBuffer> unget) {
        if (getExtraBytes() == null) {
            setExtraBytes(unget);
        } else {
            Pooled<ByteBuffer> eb = getExtraBytes();
            ByteBuffer buf = eb.getResource();
            final ByteBuffer ugBuffer = unget.getResource();

            if (ugBuffer.limit() - ugBuffer.remaining() > buf.remaining()) {
                //stuff the existing data after the data we are ungetting
                ugBuffer.compact();
                ugBuffer.put(buf);
                ugBuffer.flip();
                eb.free();
                setExtraBytes(unget);
            } else {
                //TODO: this is horrible, but should not happen often
                final byte[] data = new byte[ugBuffer.remaining() + buf.remaining()];
                int first = ugBuffer.remaining();
                ugBuffer.get(data, 0, ugBuffer.remaining());
                buf.get(data, first, buf.remaining());
                eb.free();
                unget.free();
                final ByteBuffer newBuffer = ByteBuffer.wrap(data);
                setExtraBytes(new ImmediatePooled<>(newBuffer));
            }
        }
    }

    /**
     * Pushes back the given data. This should only be used by transfer coding handlers that have read past
     * the end of the request when handling pipelined requests
     *
     * @param unget The buffer to push back
     */
    public void ungetRequestBytes(final Pooled<ByteBuffer> unget) {
        if (getExtraBytes() == null) {
            setExtraBytes(unget);
        } else {
            Pooled<ByteBuffer> eb = getExtraBytes();
            ByteBuffer buf = eb.getResource();
            final ByteBuffer ugBuffer = unget.getResource();

            if (ugBuffer.limit() - ugBuffer.remaining() > buf.remaining()) {
                //stuff the existing data after the data we are ungetting
                ugBuffer.compact();
                ugBuffer.put(buf);
                ugBuffer.flip();
                eb.free();
                setExtraBytes(unget);
            } else {
                //TODO: this is horrible, but should not happen often
                final byte[] data = new byte[ugBuffer.remaining() + buf.remaining()];
                int first = ugBuffer.remaining();
                ugBuffer.get(data, 0, ugBuffer.remaining());
                buf.get(data, first, buf.remaining());
                eb.free();
                unget.free();
                final ByteBuffer newBuffer = ByteBuffer.wrap(data);
                setExtraBytes(new ImmediatePooled<ByteBuffer>(newBuffer));
            }
        }
    }

Replace Generic With Diamond ImmediatePooled<ByteBuffer> with ImmediatePooled<> in method public ungetRequestBytes(unget Pooled<ByteBuffer>) : void from class io.undertow.server.protocol.http.HttpServerConnection


    public void handleEvent(final StreamConnection channel) {
        if (UndertowLogger.REQUEST_LOGGER.isTraceEnabled()) {
            UndertowLogger.REQUEST_LOGGER.tracef("Opened connection with %s", channel.getPeerAddress());
        }
        final PotentialSPDYConnection potentialConnection = new PotentialSPDYConnection(channel);
        channel.getSourceChannel().setReadListener(potentialConnection);
        final SSLEngine sslEngine = JsseXnioSsl.getSslEngine((SslConnection) channel);
        String existing = (String) sslEngine.getSession().getValue(PROTOCOL_KEY);
        //resuming an existing session, no need for NPN
        if (existing != null) {
            UndertowLogger.REQUEST_LOGGER.debug("Resuming existing session, not doing NPN negotiation");
            if(existing.equals(SPDY_3_1) || existing.equals(SPDY_3)) {
                SpdyChannel sc = new SpdyChannel(channel, bufferPool, new ImmediatePooled<>(ByteBuffer.wrap(new byte[0])), heapBufferPool);
                sc.getReceiveSetter().set(new SpdyReceiveListener(rootHandler, getUndertowOptions(), bufferSize));
                sc.resumeReceives();
            } else {
                if (delegate == null) {
                    UndertowLogger.REQUEST_IO_LOGGER.couldNotInitiateSpdyConnection();
                    IoUtils.safeClose(channel);
                    return;
                }
                channel.getSourceChannel().setReadListener(null);
                delegate.handleEvent(channel);
            }
        } else {
            NextProtoNego.put(sslEngine, new NextProtoNego.ServerProvider() {
                @Override
                public void unsupported() {
                    potentialConnection.selected = HTTP_1_1;
                }

                @Override
                public List<String> protocols() {
                    return Arrays.asList(SPDY_3_1, SPDY_3, HTTP_1_1);
                }

                @Override
                public void protocolSelected(String s) {
                    sslEngine.getSession().putValue(PROTOCOL_KEY, s);
                    potentialConnection.selected = s;
                }
            });
            potentialConnection.handleEvent(channel.getSourceChannel());
        }
    }

    public void handleEvent(final StreamConnection channel) {
        if (UndertowLogger.REQUEST_LOGGER.isTraceEnabled()) {
            UndertowLogger.REQUEST_LOGGER.tracef("Opened connection with %s", channel.getPeerAddress());
        }
        final PotentialSPDYConnection potentialConnection = new PotentialSPDYConnection(channel);
        channel.getSourceChannel().setReadListener(potentialConnection);
        final SSLEngine sslEngine = JsseXnioSsl.getSslEngine((SslConnection) channel);
        String existing = (String) sslEngine.getSession().getValue(PROTOCOL_KEY);
        //resuming an existing session, no need for NPN
        if (existing != null) {
            UndertowLogger.REQUEST_LOGGER.debug("Resuming existing session, not doing NPN negotiation");
            if(existing.equals(SPDY_3_1) || existing.equals(SPDY_3)) {
                SpdyChannel sc = new SpdyChannel(channel, bufferPool, new ImmediatePooled<ByteBuffer>(ByteBuffer.wrap(new byte[0])), heapBufferPool);
                sc.getReceiveSetter().set(new SpdyReceiveListener(rootHandler, getUndertowOptions(), bufferSize));
                sc.resumeReceives();
            } else {
                if (delegate == null) {
                    UndertowLogger.REQUEST_IO_LOGGER.couldNotInitiateSpdyConnection();
                    IoUtils.safeClose(channel);
                    return;
                }
                channel.getSourceChannel().setReadListener(null);
                delegate.handleEvent(channel);
            }
        } else {
            NextProtoNego.put(sslEngine, new NextProtoNego.ServerProvider() {
                @Override
                public void unsupported() {
                    potentialConnection.selected = HTTP_1_1;
                }

                @Override
                public List<String> protocols() {
                    return Arrays.asList(SPDY_3_1, SPDY_3, HTTP_1_1);
                }

                @Override
                public void protocolSelected(String s) {
                    sslEngine.getSession().putValue(PROTOCOL_KEY, s);
                    potentialConnection.selected = s;
                }
            });
            potentialConnection.handleEvent(channel.getSourceChannel());
        }
    }

Replace Generic With Diamond SpdyChannel with SpdyChannel in method public handleEvent(channel StreamConnection) : void from class io.undertow.server.protocol.spdy.SpdyOpenListener


    public InMemorySessionManager(String deploymentName, int maxSessions) {
        this.deploymentName = deploymentName;
        this.sessions = new ConcurrentHashMap<>();
        this.maxSize = maxSessions;
        ConcurrentDirectDeque<String> evictionQueue = null;
        if (maxSessions > 0) {
            evictionQueue = ConcurrentDirectDeque.newInstance();
        }
        this.evictionQueue = evictionQueue;
    }

    public InMemorySessionManager(String deploymentName, int maxSessions) {
        this.deploymentName = deploymentName;
        this.sessions = new ConcurrentHashMap<String, InMemorySession>();
        this.maxSize = maxSessions;
        ConcurrentDirectDeque<String> evictionQueue = null;
        if (maxSessions > 0) {
            evictionQueue = ConcurrentDirectDeque.newInstance();
        }
        this.evictionQueue = evictionQueue;
    }

Replace Generic With Diamond ConcurrentHashMap<String,InMemorySession> with ConcurrentHashMap<> in method public InMemorySessionManager(deploymentName String, maxSessions int) from class io.undertow.server.session.InMemorySessionManager


    @Override
    public Set<String> getAllSessions() {
        return new HashSet<>(sessions.keySet());
    }

    @Override
    public Set<String> getAllSessions() {
        return new HashSet<String>(sessions.keySet());
    }

Replace Generic With Diamond HashSet<String> with HashSet<> in method public getAllSessions() : Set<String> from class io.undertow.server.session.InMemorySessionManager


    @Override
    protected SendFrameHeader createFrameHeader() {
        ByteBuffer buf = ByteBuffer.allocate(16);

        int firstInt = SpdyChannel.CONTROL_FRAME | (getChannel().getSpdyVersion() << 16) | 7;
        SpdyProtocolUtils.putInt(buf, firstInt);
        SpdyProtocolUtils.putInt(buf, 8);
        SpdyProtocolUtils.putInt(buf, lastGoodStreamId);
        SpdyProtocolUtils.putInt(buf, status);
        buf.flip();
        return new SendFrameHeader( new ImmediatePooled<>(buf));
    }

    @Override
    protected SendFrameHeader createFrameHeader() {
        ByteBuffer buf = ByteBuffer.allocate(16);

        int firstInt = SpdyChannel.CONTROL_FRAME | (getChannel().getSpdyVersion() << 16) | 7;
        SpdyProtocolUtils.putInt(buf, firstInt);
        SpdyProtocolUtils.putInt(buf, 8);
        SpdyProtocolUtils.putInt(buf, lastGoodStreamId);
        SpdyProtocolUtils.putInt(buf, status);
        buf.flip();
        return new SendFrameHeader( new ImmediatePooled<ByteBuffer>(buf));
    }

Replace Generic With Diamond SendFrameHeader with SendFrameHeader in method protected createFrameHeader() : SendFrameHeader from class io.undertow.spdy.SpdyGoAwayStreamSinkChannel


    @Override
    protected SendFrameHeader createFrameHeader() {
        ByteBuffer buf = ByteBuffer.allocate(12);

        int firstInt = SpdyChannel.CONTROL_FRAME | (getChannel().getSpdyVersion() << 16) | 2;
        SpdyProtocolUtils.putInt(buf, firstInt);
        SpdyProtocolUtils.putInt(buf, 4); //we back fill the length
        SpdyProtocolUtils.putInt(buf, id);
        return new SendFrameHeader(new ImmediatePooled<>(buf));
    }

    @Override
    protected SendFrameHeader createFrameHeader() {
        ByteBuffer buf = ByteBuffer.allocate(12);

        int firstInt = SpdyChannel.CONTROL_FRAME | (getChannel().getSpdyVersion() << 16) | 2;
        SpdyProtocolUtils.putInt(buf, firstInt);
        SpdyProtocolUtils.putInt(buf, 4); //we back fill the length
        SpdyProtocolUtils.putInt(buf, id);
        return new SendFrameHeader(new ImmediatePooled<ByteBuffer>(buf));
    }

Replace Generic With Diamond SendFrameHeader with SendFrameHeader in method protected createFrameHeader() : SendFrameHeader from class io.undertow.spdy.SpdyPingStreamSinkChannel


    @Override
    protected SendFrameHeader createFrameHeader() {
        ByteBuffer buf = ByteBuffer.allocate(16);

        int firstInt = SpdyChannel.CONTROL_FRAME | (getChannel().getSpdyVersion() << 16) | 9;
        SpdyProtocolUtils.putInt(buf, firstInt);
        SpdyProtocolUtils.putInt(buf, 8);
        SpdyProtocolUtils.putInt(buf, streamId);
        SpdyProtocolUtils.putInt(buf, deltaWindowSize);
        buf.flip();
        return new SendFrameHeader(new ImmediatePooled<>(buf));
    }

    @Override
    protected SendFrameHeader createFrameHeader() {
        ByteBuffer buf = ByteBuffer.allocate(16);

        int firstInt = SpdyChannel.CONTROL_FRAME | (getChannel().getSpdyVersion() << 16) | 9;
        SpdyProtocolUtils.putInt(buf, firstInt);
        SpdyProtocolUtils.putInt(buf, 8);
        SpdyProtocolUtils.putInt(buf, streamId);
        SpdyProtocolUtils.putInt(buf, deltaWindowSize);
        buf.flip();
        return new SendFrameHeader(new ImmediatePooled<ByteBuffer>(buf));
    }

Replace Generic With Diamond SendFrameHeader with SendFrameHeader in method protected createFrameHeader() : SendFrameHeader from class io.undertow.spdy.SpdyWindowUpdateStreamSinkChannel


    protected Map<AttachmentKey<?>, Object> createAttachmentMap() {
        return new IdentityHashMap<>(5);
    }

    protected Map<AttachmentKey<?>, Object> createAttachmentMap() {
        return new IdentityHashMap<AttachmentKey<?>, Object>(5);
    }

Replace Generic With Diamond IdentityHashMap<AttachmentKey<?>,Object> with IdentityHashMap<> in method protected createAttachmentMap() : Map<AttachmentKey<?>,Object> from class io.undertow.util.AbstractAttachable