    /**
     * Begins the opening handshake
     *
     * @param channel Channel
     * @param promise the {@link ChannelPromise} to be notified when the opening handshake is sent
     */
    public final ChannelFuture handshake(Channel channel, final ChannelPromise promise) {
        ChannelPipeline pipeline = channel.pipeline();
        HttpResponseDecoder decoder = pipeline.get(HttpResponseDecoder.class);
        if (decoder == null) {
            HttpClientCodec codec = pipeline.get(HttpClientCodec.class);
            if (codec == null) {
                promise.setFailure(new IllegalStateException("ChannelPipeline does not contain " +
                        "an HttpResponseDecoder or HttpClientCodec"));
                handshakePromise.tryFailure(promise.cause());
                return promise;
            }
        }

        FullHttpRequest request = newHandshakeRequest();

        channel.writeAndFlush(request).addListener((ChannelFutureListener) future -> {
            if (future.isSuccess()) {
                ChannelPipeline p = future.channel().pipeline();
                ChannelHandlerContext ctx = p.context(HttpRequestEncoder.class);
                if (ctx == null) {
                    ctx = p.context(HttpClientCodec.class);
                }
                if (ctx == null) {
                    promise.setFailure(new IllegalStateException("ChannelPipeline does not contain " +
                            "an HttpRequestEncoder or HttpClientCodec"));
                    handshakePromise.tryFailure(promise.cause());
                    return;
                }
                p.addAfter(ctx.name(), "ws-encoder", newWebSocketEncoder());

                promise.setSuccess();
            } else {
                promise.setFailure(future.cause());
                handshakePromise.tryFailure(promise.cause());
            }
        });
        return promise;
    }

    /**
     * Begins the opening handshake
     *
     * @param channel Channel
     * @param promise the {@link ChannelPromise} to be notified when the opening handshake is sent
     */
    public final ChannelFuture handshake(Channel channel, final ChannelPromise promise) {
        ChannelPipeline pipeline = channel.pipeline();
        HttpResponseDecoder decoder = pipeline.get(HttpResponseDecoder.class);
        if (decoder == null) {
            HttpClientCodec codec = pipeline.get(HttpClientCodec.class);
            if (codec == null) {
                promise.setFailure(new IllegalStateException("ChannelPipeline does not contain " +
                        "an HttpResponseDecoder or HttpClientCodec"));
                handshakePromise.tryFailure(promise.cause());
                return promise;
            }
        }

        FullHttpRequest request = newHandshakeRequest();

        channel.writeAndFlush(request).addListener(new ChannelFutureListener() {
            @Override
            public void operationComplete(ChannelFuture future) {
                if (future.isSuccess()) {
                    ChannelPipeline p = future.channel().pipeline();
                    ChannelHandlerContext ctx = p.context(HttpRequestEncoder.class);
                    if (ctx == null) {
                        ctx = p.context(HttpClientCodec.class);
                    }
                    if (ctx == null) {
                        promise.setFailure(new IllegalStateException("ChannelPipeline does not contain " +
                                "an HttpRequestEncoder or HttpClientCodec"));
                        handshakePromise.tryFailure(promise.cause());
                        return;
                    }
                    p.addAfter(ctx.name(), "ws-encoder", newWebSocketEncoder());

                    promise.setSuccess();
                } else {
                    promise.setFailure(future.cause());
                    handshakePromise.tryFailure(promise.cause());
                }
            }
        });
        return promise;
    }

Replace Anonymous With Lambda io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker.handshake.addListener.new ChannelFutureListener with future -> {if(future.isSuccess()){ChannelPipeline p=future.channel().pipeline(); in method public handshake(channel Channel, promise ChannelPromise) : ChannelFuture from class io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker


    private void applyForceCloseTimeout(final Channel channel, ChannelFuture flushFuture) {
        final long forceCloseTimeoutMillis = this.forceCloseTimeoutMillis;
        final WebSocketClientHandshaker handshaker = this;
        if (forceCloseTimeoutMillis <= 0 || !channel.isActive() || forceCloseInit != 0) {
            return;
        }

        flushFuture.addListener((ChannelFutureListener) future -> {
            // If flush operation failed, there is no reason to expect
            // a server to receive CloseFrame. Thus this should be handled
            // by the application separately.
            // Also, close might be called twice from different threads.
            if (future.isSuccess() && channel.isActive() &&
                    FORCE_CLOSE_INIT_UPDATER.compareAndSet(handshaker, 0, 1)) {
                final Future<?> forceCloseFuture = channel.eventLoop().schedule(() -> {
                    if (channel.isActive()) {
                        channel.close();
                        forceCloseComplete = true;
                    }
                }, forceCloseTimeoutMillis, TimeUnit.MILLISECONDS);

                channel.closeFuture().addListener((ChannelFutureListener) future1 -> forceCloseFuture.cancel(false));
            }
        });
    }

    private void applyForceCloseTimeout(final Channel channel, ChannelFuture flushFuture) {
        final long forceCloseTimeoutMillis = this.forceCloseTimeoutMillis;
        final WebSocketClientHandshaker handshaker = this;
        if (forceCloseTimeoutMillis <= 0 || !channel.isActive() || forceCloseInit != 0) {
            return;
        }

        flushFuture.addListener(new ChannelFutureListener() {
            @Override
            public void operationComplete(ChannelFuture future) throws Exception {
                // If flush operation failed, there is no reason to expect
                // a server to receive CloseFrame. Thus this should be handled
                // by the application separately.
                // Also, close might be called twice from different threads.
                if (future.isSuccess() && channel.isActive() &&
                        FORCE_CLOSE_INIT_UPDATER.compareAndSet(handshaker, 0, 1)) {
                    final Future<?> forceCloseFuture = channel.eventLoop().schedule(new Runnable() {
                        @Override
                        public void run() {
                            if (channel.isActive()) {
                                channel.close();
                                forceCloseComplete = true;
                            }
                        }
                    }, forceCloseTimeoutMillis, TimeUnit.MILLISECONDS);

                    channel.closeFuture().addListener(new ChannelFutureListener() {
                        @Override
                        public void operationComplete(ChannelFuture future) throws Exception {
                            forceCloseFuture.cancel(false);
                        }
                    });
                }
            }
        });
    }

Replace Anonymous With Lambda io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker.applyForceCloseTimeout.addListener.new ChannelFutureListener with future -> {if(future.isSuccess() && channel.isActive() && FORCE_CLOSE_INIT_UPDATER.compareAndSet(handshaker,0,1)){final Future<?> forceCloseFuture=channel.eventLoop().schedule(() -> { in method private applyForceCloseTimeout(channel Channel, flushFuture ChannelFuture) : void from class io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker


    public void newIterator(List<T> list) {
        this.list = Objects.requireNonNull(list, "list");

        index = 0;
        this.iterator = new Iterator<>() {
            @Override
            public boolean hasNext() {
                // Because it's round-robin
                return true;
            }

            @Override
            public T next() {
                try {
                    // If Index size has reached List size, set it to zero.
                    // Else, get the element from list as per latest Index count.
                    if (index >= list.size()) {
                        index = 0;
                    }
                    return list.get(index);
                } finally {
                    index++;
                }
            }

            @Override
            public void remove() {
                // We don't support removal of elements
                // because we're just a Round-Robin Iterator.
                throw new UnsupportedOperationException();
            }
        };
    }

    public RoundRobinList(List<T> list) {
        this.list = list;
        this.iterator = new Iterator<T>() {
            @Override
            public boolean hasNext() {
                // Because it's round-robin
                return true;
            }

            @Override
            public T next() {
                try {
                    // If Index size has reached List size, set it to zero.
                    // Else, get the element from list as per latest Index count.
                    if (index >= list.size()) {
                        index = 0;
                    }
                    return list.get(index);
                } finally {
                    index++;
                }
            }

            @Override
            public void remove() {
                // We don't support removal of elements
                throw new UnsupportedOperationException();
            }
        };
    }

Replace Generic With Diamond Iterator<T> with Iterator<> in method public newIterator(list List<T>) : void from class com.shieldblaze.expressgateway.common.list.RoundRobinList


	@Override
	public final void close() {
		super.status = false;
		final StringBuilder sb = new StringBuilder(2000);
		list.forEach(s-> sb.append(s));
		final String s = sb.toString();
		try(writer){
			synchronized (writer) {
				writer.write(s);
				writer.flush();
			}
		} catch (Exception e) {e.printStackTrace();}
		list.clear();
	}

	@Override
	public final void close() {
		super.status = false;
		final StringBuilder sb = new StringBuilder(2000);
		list.forEach(s-> sb.append(s));
		final String s = sb.toString();
		try{
			synchronized (writer) {
				writer.write(s);
				writer.flush();
			}
		} catch (Exception e) {e.printStackTrace();}

		list.clear();
	}

Try With Resources try(writer) in method public close() : void from class org.util.nanolog.internals.BufferedDailyLogger


	@Override
	public final void close() {
		super.status = false;
		final StringBuilder sb = new StringBuilder(2000);
		list.forEach(s-> sb.append(s));
		final String s = sb.toString();
		try(writer) {
			synchronized (writer) {
				writer.write(s);
				writer.flush();
			}
		} catch (Exception e) {e.printStackTrace();}
		list.clear();
	}

	@Override
	public final void close() {
		super.status = false;
		final StringBuilder sb = new StringBuilder(2000);
		list.forEach(s-> sb.append(s));
		final String s = sb.toString();
		try{
			synchronized (writer) {
				writer.write(s);
				writer.flush();
			}
		} catch (Exception e) {e.printStackTrace();}
		list.clear();
	}

Try With Resources try(writer) in method public close() : void from class org.util.nanolog.internals.BufferedLogger


    public ArrayList<String> getLikeReport(String str) {

        ArrayList<String> report = new ArrayList<>();

        try {
            Connection conn = connect();
            StringBuffer GET_LIKE_REPORT = new StringBuffer("SELECT * FROM reports WHERE report_name LIKE ");
            GET_LIKE_REPORT.append("\'");
            GET_LIKE_REPORT.append("%");
            GET_LIKE_REPORT.append(new StringBuffer(str.toUpperCase()));
            GET_LIKE_REPORT.append("%';");

            PreparedStatement preparedStatement = conn.prepareStatement(new String(GET_LIKE_REPORT));
            ResultSet rs = preparedStatement.executeQuery();
            int i = 0;
            while (rs.next()) {
                report.add(rs.getString("report_name"));
                i++;
            }
            return report;

        } catch (SQLException e) {
            System.out.println(e);
        }
        return null;
    }

    public ArrayList<String> getLikeReport(String str) {

        ArrayList<String> report = new ArrayList<String>();

        try {
            Connection conn = connect();
            StringBuffer GET_LIKE_REPORT = new StringBuffer("SELECT * FROM reports WHERE report_name LIKE ");
            GET_LIKE_REPORT.append("\'");
            GET_LIKE_REPORT.append("%");
            GET_LIKE_REPORT.append(new StringBuffer(str.toUpperCase()));
            GET_LIKE_REPORT.append("%';");

            PreparedStatement preparedStatement = conn.prepareStatement(new String(GET_LIKE_REPORT));
            ResultSet rs = preparedStatement.executeQuery();
            int i = 0;
            while (rs.next()) {
                report.add(rs.getString("report_name"));
                i++;
            }
            return report;

        } catch (SQLException e) {
            System.out.println(e);
        }
        return null;
    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public getLikeReport(str String) : ArrayList<String> from class database.Database


    public static void main(String args[]) {
        Main sc = new Main();
        Home home = new Home();

         java.awt.EventQueue.invokeLater(() -> {
            sc.setVisible(true);
        });

        String[] msg = {"Establishing Database Connection...", "Loading Patient Records...", "Preparing User Interface...", "Syncing Data...", "Preparing Dashboard..."};
        int k = 0;

        try {

            for (int i = 0; i < 100; i++) {

                if (i == 60) {
                    Thread.sleep(1000);
                }
                if (i < 30) {
                    Thread.sleep(40);
                } else if (i < 60) {
                    Thread.sleep(60);
                } else if (i < 80) {
                    Thread.sleep(30);
                } else {
                    Thread.sleep(20);

                }
                info_msg.setText(msg[k]);
                if (i == 40 || i == 60 || i == 80 || i == 90) {
                    k++;
                }

                Thread.sleep(0);

                sc.progress.setValue(i);
                sc.completed.setText(Integer.toString(i) + "%");
            }
        } catch (InterruptedException exp) {

        }
        new Main().setVisible(false);
      //  home.setVisible(true);
         Authentication authentication  = new Authentication(home);
         authentication.setVisible(true);

        sc.dispose();
    }

    public static void main(String args[]) {
        Main sc = new Main();
        Home home = new Home();

        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                sc.setVisible(true);

            }
        });

        String[] msg = {"Establishing Database Connection...", "Loading Patient Records...", "Preparing User Interface...", "Syncing Data...", "Preparing Dashboard..."};
        int k = 0;

        try {

            for (int i = 0; i < 100; i++) {

                if (i == 60) {
                    Thread.sleep(1000);
                }
                if (i < 30) {
                    Thread.sleep(40);
                } else if (i < 60) {
                    Thread.sleep(60);
                } else if (i < 80) {
                    Thread.sleep(30);
                } else {
                    Thread.sleep(20);

                }
                info_msg.setText(msg[k]);
                if (i == 40 || i == 60 || i == 80 || i == 90) {
                    k++;
                }

                Thread.sleep(0);

                sc.progress.setValue(i);
                sc.completed.setText(Integer.toString(i) + "%");
            }
        } catch (InterruptedException exp) {

        }
        new Main().setVisible(false);
//        home.setVisible(true);
         Authentication authentication  = new Authentication(home);
         authentication.setVisible(true);

        sc.dispose();
    }

Replace Anonymous With Lambda hospitalmanagement.Main.main.invokeLater.new Runnable with () -> {sc.setVisible(true); in method public main(args String[]) : void from class hospitalmanagement.Main


    private static void invokeMethodRequestContext(String methodName, Class methodSignature, Object arguments) {
        try {
            Object requestContext = getRequestContextInstance();
            Method methodExecute = requestContext.getClass().getDeclaredMethod(methodName, methodSignature);
            methodExecute.invoke(requestContext, arguments);
        } catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | ClassNotFoundException | NoSuchMethodException ex) {
            throw new RuntimeException(ex);
        }
    }

    private static void invokeMethodRequestContext(String methodName, Class methodSignature, Object arguments) {
        try {
            Object requestContext = getRequestContextInstance();
            Method methodExecute = requestContext.getClass().getDeclaredMethod(methodName, methodSignature);
            methodExecute.invoke(requestContext, arguments);
        } catch (NoSuchMethodException ex) {
            throw new RuntimeException(ex);
        } catch (SecurityException ex) {
            throw new RuntimeException(ex);
        } catch (IllegalAccessException ex) {
            throw new RuntimeException(ex);
        } catch (IllegalArgumentException ex) {
            throw new RuntimeException(ex);
        } catch (InvocationTargetException ex) {
            throw new RuntimeException(ex);
        } catch (ClassNotFoundException ex) {
            throw new RuntimeException(ex);
        }
    }

Merge Catch [catch(NoSuchMethodException ex), catch(SecurityException ex), catch(IllegalAccessException ex), catch(IllegalArgumentException ex), catch(InvocationTargetException ex), catch(ClassNotFoundException ex)] to catch(SecurityException|IllegalAccessException|IllegalArgumentException|InvocationTargetException|ClassNotFoundException|NoSuchMethodException ex) in method private invokeMethodRequestContext(methodName String, methodSignature Class, arguments Object) : void from class com.xpert.faces.primefaces.PrimeFacesUtils


    /**
     * This method get by reflection primefaces build version.
     *
     * The reason why use reflection is:
     *
     * Primefaces 3 uses org.primefaces.util.Constants.
     *
     * Primefaces 4,5, and 6 uses
     * RequestContext.getCurrentInstance().getApplicationContext().getConfig().getBuildVersion().
     *
     * However in primefaces 4 and 5 getConfig() returns
     * org.primefaces.config.ConfigConteiner and primefaces 6 returns
     * org.primefaces.config.PrimeConfiguration.
     *
     *
     * @return
     */
    public static String getPrimefacesBuildVersion() {

        if (isUseRequestContext()) {

            try {
                Object requestContext = getRequestContextInstance();
                //acess getApplicationContext()
                Method methodGetApplicationContext= requestContext.getClass().getDeclaredMethod("getApplicationContext");
                Object applicationContext = methodGetApplicationContext.invoke(requestContext);
                //acess getConfig()
                Method methodGetConfig = applicationContext.getClass().getDeclaredMethod("getConfig");
                Object config = methodGetConfig.invoke(applicationContext);
                //acess getBuildVersion()
                Method methodGetBuildVersion = config.getClass().getDeclaredMethod("getBuildVersion");
                String buildVersion = (String) methodGetBuildVersion.invoke(config);

                return buildVersion;
            } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | ClassNotFoundException ex) {
                throw new RuntimeException(ex);
            }
        } else {
            //for primefaces > 6
            return PrimeRequestContext.getCurrentInstance().getApplicationContext().getEnvironment().getBuildVersion();
        }
    }

    /**
     * This method get by reflection primefaces build version.
     *
     * The reason why use reflection is:
     *
     * Primefaces 3 uses org.primefaces.util.Constants.
     *
     * Primefaces 4,5, and 6 uses
     * RequestContext.getCurrentInstance().getApplicationContext().getConfig().getBuildVersion().
     *
     * However in primefaces 4 and 5 getConfig() returns
     * org.primefaces.config.ConfigConteiner and primefaces 6 returns
     * org.primefaces.config.PrimeConfiguration.
     *
     *
     * @return
     */
    public static String getPrimefacesBuildVersion() {

        if (isUseRequestContext()) {

            try {
                Object requestContext = getRequestContextInstance();
                //acess getApplicationContext()
                Method methodGetApplicationContext= requestContext.getClass().getDeclaredMethod("getApplicationContext");
                Object applicationContext = methodGetApplicationContext.invoke(requestContext);
                //acess getConfig()
                Method methodGetConfig = applicationContext.getClass().getDeclaredMethod("getConfig");
                Object config = methodGetConfig.invoke(applicationContext);
                //acess getBuildVersion()
                Method methodGetBuildVersion = config.getClass().getDeclaredMethod("getBuildVersion");
                String buildVersion = (String) methodGetBuildVersion.invoke(config);

                return buildVersion;
            } catch (NoSuchMethodException ex) {
                throw new RuntimeException(ex);
            } catch (SecurityException ex) {
                throw new RuntimeException(ex);
            } catch (IllegalAccessException ex) {
                throw new RuntimeException(ex);
            } catch (IllegalArgumentException ex) {
                throw new RuntimeException(ex);
            } catch (InvocationTargetException ex) {
                throw new RuntimeException(ex);
            } catch (ClassNotFoundException ex) {
                throw new RuntimeException(ex);
            }
        } else {
            //for primefaces > 6
            return PrimeRequestContext.getCurrentInstance().getApplicationContext().getEnvironment().getBuildVersion();
        }
    }

Merge Catch [catch(NoSuchMethodException ex), catch(SecurityException ex), catch(IllegalAccessException ex), catch(IllegalArgumentException ex), catch(InvocationTargetException ex), catch(ClassNotFoundException ex)] to catch(NoSuchMethodException|SecurityException|IllegalAccessException|IllegalArgumentException|InvocationTargetException|ClassNotFoundException ex) in method public getPrimefacesBuildVersion() : String from class com.xpert.faces.primefaces.PrimeFacesUtils


    public List<AbstractMetadata> getMetadata(Object object, Object persisted, AbstractAuditing auditing) throws Exception {
        //verify null object
        if(object == null){
            return null;
        }
        List<Method> methodsGet = getMethods(object);
        List<AbstractMetadata> metadatas = new ArrayList<>();
        boolean isDelete = auditing.getAuditingType() != null && auditing.getAuditingType().equals(AuditingType.DELETE);
        for (Method method : methodsGet) {
            try {
                Object fieldValue = method.invoke(object);
                Object fieldOld = null;
                if (persisted != null) {
                    fieldOld = method.invoke(persisted);
                    //both null values dont audit
                    if (fieldOld == null && fieldValue == null) {
                        continue;
                    }
                }
                AbstractMetadata metadata = Configuration.getAbstractMetadata();
                if (fieldValue != null && fieldValue.getClass().isAnnotationPresent(Embeddable.class)) {
                    List<AbstractMetadata> embedableMetadata = getMetadata(fieldValue, persisted == null ? null : method.invoke(persisted), auditing);
                    if (embedableMetadata != null && !embedableMetadata.isEmpty()) {
                        metadatas.addAll(embedableMetadata);
                    }
                } else {
                    //if "persisted object" is null then always add metadata
                    boolean addMetadata = persisted == null;
                    //for list types
                    if (method.getReturnType().equals(Collection.class) || method.getReturnType().equals(List.class) || method.getReturnType().equals(Set.class)) { //para as coleções
                        Collection collectionNew = (Collection<Object>) fieldValue;
                        Collection collectionOld = (Collection<Object>) fieldOld;
                        StringBuilder newValue = new StringBuilder();
                        if (fieldOld == null) {
                            if (collectionNew != null) {
                                for (Object item : collectionNew) {
                                    newValue.append(item.toString()).append("; ");
                                }
                                addMetadata = true;
                            }
                        } else {
                            StringBuilder oldValue = new StringBuilder();
                            if ((!(collectionNew instanceof PersistentBag) && !(collectionNew instanceof PersistentCollection)) || isDelete == true) {
                                //diferent size, then add to metadata
                                if (collectionNew != null && collectionOld != null && collectionNew.size() != collectionOld.size()) {
                                    addMetadata = true;
                                } else {
                                    if (collectionNew != null) {
                                        //verify if some item from list has changed
                                        for (Object current : collectionNew) {
                                            if (collectionOld != null && !collectionOld.contains(current)) {
                                                for (Object currentOld : collectionOld) {
                                                    if (!currentOld.equals(current)) {
                                                        addMetadata = true;
                                                        break;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                if (collectionOld != null) {
                                    for (Object old : collectionOld) {
                                        oldValue.append(old).append("; ");
                                    }
                                }
                                if (collectionNew != null) {
                                    for (Object item : collectionNew) {
                                        newValue.append(item.toString()).append("; ");
                                    }
                                }
                                metadata.setOldValue(oldValue.toString());
                            }
                        }
                        metadata.setNewValue(newValue.toString());
                    } else if (isEntity(method.getReturnType())) {
                        Object newId = EntityUtils.getId(fieldValue);
                        boolean cannotInitialize = !entityManager.contains(fieldValue);

                        //a proxy doesnt has value changed
                        if (!(fieldValue instanceof HibernateProxy && cannotInitialize) || isDelete == true) {
                            /**
                             * One to One cascade ALL
                             */
                            if (isOneToOneCascadeAll(method)) {
                                List<AbstractMetadata> embedableMetadata = null;
                                //add metadata for oneToOne cascade all based on new object
                                if (persisted == null) {
                                    embedableMetadata = getMetadata(fieldValue, null, auditing);
                                } else {
                                    embedableMetadata = getMetadata(fieldValue, getPersisted(fieldValue), auditing);
                                }

                                if (embedableMetadata != null && !embedableMetadata.isEmpty()) {
                                    metadatas.addAll(embedableMetadata);
                                }
                            }

                            Object oldId = null;
                            if (fieldOld instanceof HibernateProxy) {
                                oldId = ((HibernateProxy) fieldOld).getHibernateLazyInitializer().getIdentifier();
                            } else {
                                oldId = EntityUtils.getId(fieldOld);
                            }
                            //set id if is numeric
                            if (oldId != null && oldId.toString() != null && !oldId.toString().isEmpty() && StringUtils.isNumeric(oldId.toString())) {
                                metadata.setOldIdentifier(Long.valueOf(oldId.toString()));
                            }
                            metadata.setOldValue(fieldOld == null ? "" : fieldOld.toString());
                            if ((oldId == null && newId != null) || (oldId != null && newId == null) || (oldId != null && !oldId.equals(newId))) {
                                addMetadata = true;
                            }
                            metadata.setEntity(method.getDeclaringClass().getName());
                            //set id if is numeric
                            if (newId != null && newId.toString() != null && !newId.toString().isEmpty() && StringUtils.isNumeric(newId.toString())) {
                                metadata.setNewIdentifier(Long.valueOf(newId.toString()));
                            }
                            metadata.setNewValue(fieldValue == null ? "" : fieldValue.toString());

                        }
                    } else {
                        if (fieldOld != null) {
                            metadata.setOldValue(getToString(fieldOld));
                        }
                        if (fieldValue != null) {
                            metadata.setNewValue(getToString(fieldValue));
                        }
                        //verify empty String
                        if (fieldValue instanceof String) {
                            if ((fieldOld == null && fieldValue != null && !fieldValue.toString().isEmpty())
                                    || (fieldOld != null && !fieldOld.toString().isEmpty() && fieldValue == null)
                                    || (fieldOld != null && !fieldOld.equals(fieldValue))) {
                                addMetadata = true;
                            }
                        } else {
                            if (!isEquals(fieldOld, fieldValue)) {
                                addMetadata = true;
                            }
                        }
                    }
                    metadata.setField(getMethodName(method));
                    metadata.setAuditing(auditing);
                    if (addMetadata) {
                        //verify size of metadata
                        normalizeValuesWithMaxSize(metadata);
                        metadatas.add(metadata);
                    }
                }
            } catch (Throwable t) {
                logger.log(Level.SEVERE, t.getMessage(), t);
            }
        }
        return metadatas;
    }

    public List<AbstractMetadata> getMetadata(Object object, Object persisted, AbstractAuditing auditing) throws Exception {
        //verify null object
        if(object == null){
            return null;
        }
        List<Method> methodsGet = getMethods(object);
        List<AbstractMetadata> metadatas = new ArrayList<AbstractMetadata>();
        boolean isDelete = auditing.getAuditingType() != null && auditing.getAuditingType().equals(AuditingType.DELETE);
        for (Method method : methodsGet) {
            try {
                Object fieldValue = method.invoke(object);
                Object fieldOld = null;
                if (persisted != null) {
                    fieldOld = method.invoke(persisted);
                    //both null values dont audit
                    if (fieldOld == null && fieldValue == null) {
                        continue;
                    }
                }
                AbstractMetadata metadata = Configuration.getAbstractMetadata();
                if (fieldValue != null && fieldValue.getClass().isAnnotationPresent(Embeddable.class)) {
                    List<AbstractMetadata> embedableMetadata = getMetadata(fieldValue, persisted == null ? null : method.invoke(persisted), auditing);
                    if (embedableMetadata != null && !embedableMetadata.isEmpty()) {
                        metadatas.addAll(embedableMetadata);
                    }
                } else {
                    //if "persisted object" is null then always add metadata
                    boolean addMetadata = persisted == null;
                    //for list types
                    if (method.getReturnType().equals(Collection.class) || method.getReturnType().equals(List.class) || method.getReturnType().equals(Set.class)) { //para as coleções
                        Collection collectionNew = (Collection<Object>) fieldValue;
                        Collection collectionOld = (Collection<Object>) fieldOld;
                        StringBuilder newValue = new StringBuilder();
                        if (fieldOld == null) {
                            if (collectionNew != null) {
                                for (Object item : collectionNew) {
                                    newValue.append(item.toString()).append("; ");
                                }
                                addMetadata = true;
                            }
                        } else {
                            StringBuilder oldValue = new StringBuilder();
                            if ((!(collectionNew instanceof PersistentBag) && !(collectionNew instanceof PersistentCollection)) || isDelete == true) {
                                //diferent size, then add to metadata
                                if (collectionNew != null && collectionOld != null && collectionNew.size() != collectionOld.size()) {
                                    addMetadata = true;
                                } else {
                                    if (collectionNew != null) {
                                        //verify if some item from list has changed
                                        for (Object current : collectionNew) {
                                            if (collectionOld != null && !collectionOld.contains(current)) {
                                                for (Object currentOld : collectionOld) {
                                                    if (!currentOld.equals(current)) {
                                                        addMetadata = true;
                                                        break;
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                if (collectionOld != null) {
                                    for (Object old : collectionOld) {
                                        oldValue.append(old).append("; ");
                                    }
                                }
                                if (collectionNew != null) {
                                    for (Object item : collectionNew) {
                                        newValue.append(item.toString()).append("; ");
                                    }
                                }
                                metadata.setOldValue(oldValue.toString());
                            }
                        }
                        metadata.setNewValue(newValue.toString());
                    } else if (isEntity(method.getReturnType())) {
                        Object newId = EntityUtils.getId(fieldValue);
                        boolean cannotInitialize = !entityManager.contains(fieldValue);

                        //a proxy doesnt has value changed
                        if (!(fieldValue instanceof HibernateProxy && cannotInitialize) || isDelete == true) {
                            /**
                             * One to One cascade ALL
                             */
                            if (isOneToOneCascadeAll(method)) {
                                List<AbstractMetadata> embedableMetadata = null;
                                //add metadata for oneToOne cascade all based on new object
                                if (persisted == null) {
                                    embedableMetadata = getMetadata(fieldValue, null, auditing);
                                } else {
                                    embedableMetadata = getMetadata(fieldValue, getPersisted(fieldValue), auditing);
                                }

                                if (embedableMetadata != null && !embedableMetadata.isEmpty()) {
                                    metadatas.addAll(embedableMetadata);
                                }
                            }

                            Object oldId = null;
                            if (fieldOld instanceof HibernateProxy) {
                                oldId = ((HibernateProxy) fieldOld).getHibernateLazyInitializer().getIdentifier();
                            } else {
                                oldId = EntityUtils.getId(fieldOld);
                            }
                            //set id if is numeric
                            if (oldId != null && oldId.toString() != null && !oldId.toString().isEmpty() && StringUtils.isNumeric(oldId.toString())) {
                                metadata.setOldIdentifier(Long.valueOf(oldId.toString()));
                            }
                            metadata.setOldValue(fieldOld == null ? "" : fieldOld.toString());
                            if ((oldId == null && newId != null) || (oldId != null && newId == null) || (oldId != null && !oldId.equals(newId))) {
                                addMetadata = true;
                            }
                            metadata.setEntity(method.getDeclaringClass().getName());
                            //set id if is numeric
                            if (newId != null && newId.toString() != null && !newId.toString().isEmpty() && StringUtils.isNumeric(newId.toString())) {
                                metadata.setNewIdentifier(Long.valueOf(newId.toString()));
                            }
                            metadata.setNewValue(fieldValue == null ? "" : fieldValue.toString());

                        }
                    } else {
                        if (fieldOld != null) {
                            metadata.setOldValue(getToString(fieldOld));
                        }
                        if (fieldValue != null) {
                            metadata.setNewValue(getToString(fieldValue));
                        }
                        //verify empty String
                        if (fieldValue instanceof String) {
                            if ((fieldOld == null && fieldValue != null && !fieldValue.toString().isEmpty())
                                    || (fieldOld != null && !fieldOld.toString().isEmpty() && fieldValue == null)
                                    || (fieldOld != null && !fieldOld.equals(fieldValue))) {
                                addMetadata = true;
                            }
                        } else {
                            if (!isEquals(fieldOld, fieldValue)) {
                                addMetadata = true;
                            }
                        }
                    }
                    metadata.setField(getMethodName(method));
                    metadata.setAuditing(auditing);
                    if (addMetadata) {
                        //verify size of metadata
                        normalizeValuesWithMaxSize(metadata);
                        metadatas.add(metadata);
                    }
                }
            } catch (Throwable t) {
                logger.log(Level.SEVERE, t.getMessage(), t);
            }
        }
        return metadatas;
    }

Replace Generic With Diamond ArrayList<AbstractMetadata> with ArrayList<> in method public getMetadata(object Object, persisted Object, auditing AbstractAuditing) : List<AbstractMetadata> from class com.xpert.audit.Audit


    public List<Method> getMethods(Object objeto) {

        Class entityClass = EntityUtils.getPersistentClass(objeto);
        List<Method> methodGet = MAPPED_METHODS.get(entityClass);

        if (methodGet != null) {
            return methodGet;
        }

        methodGet = new ArrayList<>();
        Method methods[] = entityClass.getMethods();

        List exclude = Arrays.asList(EXCLUDED_FIELDS);

        try {
            Field field;
            String fieldName;
            for (int j = 0; j < methods.length; j++) {
                field = null;
                fieldName = "";
                try {
                    if (methods[j] != null && !methods[j].isAnnotationPresent(Transient.class)
                            && !methods[j].isAnnotationPresent(NotAudited.class)
                            && !methods[j].isAnnotationPresent(Id.class) && !exclude.contains(methods[j].getName())) {
                        fieldName = getMethodName(methods[j]);
                    }
                    if (fieldName != null && !fieldName.equals("")) {
                        try {
                            field = getDeclaredField(methods[j].getDeclaringClass(), fieldName);
                        } catch (NoSuchFieldException ex) {
                            continue;
                        }
                        if (field != null && !field.isAnnotationPresent(Transient.class) && !field.isAnnotationPresent(NotAudited.class)
                                && !field.isAnnotationPresent(Id.class)) {
                            methodGet.add(methods[j]);
                        }
                    }
                } catch (Exception ex) {
                    logger.log(Level.SEVERE, ex.getMessage(), ex);
                }
            }
        } catch (Exception ex) {
            logger.log(Level.SEVERE, ex.getMessage(), ex);
        }
        MAPPED_METHODS.put(entityClass, methodGet);
        return methodGet;
    }

    public List<Method> getMethods(Object objeto) {

        Class entityClass = EntityUtils.getPersistentClass(objeto);
        List<Method> methodGet = MAPPED_METHODS.get(entityClass);

        if (methodGet != null) {
            return methodGet;
        }

        methodGet = new ArrayList<Method>();
        Method methods[] = entityClass.getMethods();

        List exclude = Arrays.asList(EXCLUDED_FIELDS);

        try {
            Field field;
            String fieldName;
            for (int j = 0; j < methods.length; j++) {
                field = null;
                fieldName = "";
                try {
                    if (methods[j] != null && !methods[j].isAnnotationPresent(Transient.class)
                            && !methods[j].isAnnotationPresent(NotAudited.class)
                            && !methods[j].isAnnotationPresent(Id.class) && !exclude.contains(methods[j].getName())) {
                        fieldName = getMethodName(methods[j]);
                    }
                    if (fieldName != null && !fieldName.equals("")) {
                        try {
                            field = getDeclaredField(methods[j].getDeclaringClass(), fieldName);
                        } catch (NoSuchFieldException ex) {
                            continue;
                        }
                        if (field != null && !field.isAnnotationPresent(Transient.class) && !field.isAnnotationPresent(NotAudited.class)
                                && !field.isAnnotationPresent(Id.class)) {
                            methodGet.add(methods[j]);
                        }
                    }
                } catch (Exception ex) {
                    logger.log(Level.SEVERE, ex.getMessage(), ex);
                }
            }
        } catch (Exception ex) {
            logger.log(Level.SEVERE, ex.getMessage(), ex);
        }
        MAPPED_METHODS.put(entityClass, methodGet);
        return methodGet;
    }

Replace Generic With Diamond ArrayList<Method> with ArrayList<> in method public getMethods(objeto Object) : List<Method> from class com.xpert.audit.Audit


    public void load() {
        if (beanModel != null) {
            auditings = new LazyDataModelImpl<>("eventDate DESC", getRestrictions(), baseDAO);
        }
    }

    public void load() {
        if (beanModel != null) {
            auditings = new LazyDataModelImpl<AbstractAuditing>("eventDate DESC", getRestrictions(), baseDAO);
        }
    }

Replace Generic With Diamond LazyDataModelImpl<AbstractAuditing> with LazyDataModelImpl<> in method public load() : void from class com.xpert.audit.DetailAuditBean


    private List<Restriction> getRestrictions() {

        List<Restriction> restrictions = new ArrayList<>();
        //Long doesnt need conversion
        if (beanModel.getId() instanceof Long) {
            restrictions.add(new Restriction("identifier", beanModel.getId()));
        } else if (beanModel.getId() instanceof Number) {
            //if is a number try to convert to long
            restrictions.add(new Restriction("identifier", ((Number) beanModel.getId()).longValue()));
        } else {
            throw new IllegalArgumentException("Type of id " + beanModel.getId().getClass().getName() + " from class " + beanModel.getEntity() + " is not supported in audit");
        }
        restrictions.add(new Restriction("entity", beanModel.getEntity()));

        return restrictions;
    }

    private List<Restriction> getRestrictions() {

        List<Restriction> restrictions = new ArrayList<Restriction>();
        //Long doesnt need conversion
        if (beanModel.getId() instanceof Long) {
            restrictions.add(new Restriction("identifier", beanModel.getId()));
        } else if (beanModel.getId() instanceof Number) {
            //if is a number try to convert to long
            restrictions.add(new Restriction("identifier", ((Number) beanModel.getId()).longValue()));
        } else {
            throw new IllegalArgumentException("Type of id " + beanModel.getId().getClass().getName() + " from class " + beanModel.getEntity() + " is not supported in audit");
        }
        restrictions.add(new Restriction("entity", beanModel.getEntity()));

        return restrictions;
    }

Replace Generic With Diamond ArrayList<Restriction> with ArrayList<> in method private getRestrictions() : List<Restriction> from class com.xpert.audit.DetailAuditBean


    /**
     * Creates a LazyDataModelImpl to entity
     */
    public void createDataModel() {
        dataModel = new LazyDataModelImpl<>(getDataModelOrder(), getDAO());
        dataModel.setRestrictions(getDataModelRestrictions());
        OrderByHandler orderByHandler = getOrderByHandler();
        if (orderByHandler != null) {
            dataModel.setOrderByHandler(orderByHandler);
        }
        FilterByHandler filterByHandler = getFilterByHandler();
        if (filterByHandler != null) {
            dataModel.setFilterByHandler(filterByHandler);
        }
        dataModel.setLazyCountType(getDataModelLazyCountType());
        dataModel.setJoinBuilder(getDataModelJoinBuilder());
    }

    /**
     * Creates a LazyDataModelImpl to entity
     */
    public void createDataModel() {
        dataModel = new LazyDataModelImpl<T>(getDataModelOrder(), getDAO());
        dataModel.setRestrictions(getDataModelRestrictions());
        OrderByHandler orderByHandler = getOrderByHandler();
        if (orderByHandler != null) {
            dataModel.setOrderByHandler(orderByHandler);
        }
        FilterByHandler filterByHandler = getFilterByHandler();
        if (filterByHandler != null) {
            dataModel.setFilterByHandler(filterByHandler);
        }
        dataModel.setLazyCountType(getDataModelLazyCountType());
        dataModel.setJoinBuilder(getDataModelJoinBuilder());
    }

Replace Generic With Diamond LazyDataModelImpl<T> with LazyDataModelImpl<> in method public createDataModel() : void from class com.xpert.core.crud.AbstractBaseBean


    public void add(String mensagem, Object... parametros) {
        if (exceptions == null) {
            exceptions = new ArrayList<>();
        }
        exceptions.add(new StackException(mensagem, parametros));
    }

    public void add(String mensagem, Object... parametros) {
        if (exceptions == null) {
            exceptions = new ArrayList<StackException>();
        }
        exceptions.add(new StackException(mensagem, parametros));
    }

Replace Generic With Diamond ArrayList<StackException> with ArrayList<> in method public add(mensagem String, parametros Object...) : void from class com.xpert.core.exception.StackException


    public void add(StackException ex) {
        if (exceptions == null) {
            exceptions = new ArrayList<>();
        }
        if (ex.getExceptions() == null || ex.getExceptions().isEmpty()) {
            exceptions.add(ex);
        } else {
            for (StackException ce : ex.getExceptions()) {
                exceptions.add(ce);
            }
        }
    }

    public void add(StackException ex) {
        if (exceptions == null) {
            exceptions = new ArrayList<StackException>();
        }
        if (ex.getExceptions() == null || ex.getExceptions().isEmpty()) {
            exceptions.add(ex);
        } else {
            for (StackException ce : ex.getExceptions()) {
                exceptions.add(ce);
            }
        }
    }

Replace Generic With Diamond ArrayList<StackException> with ArrayList<> in method public add(ex StackException) : void from class com.xpert.core.exception.StackException


    @Override
    public void validate(FacesContext context, UIComponent component, Object value) {

        Object cachedObject = context.getExternalContext().getApplicationMap().get(VALIDATOR_FACTORY_KEY);
        if (cachedObject instanceof ValidatorFactory) {
            ValidatorFactory validatorFactory = (ValidatorFactory) cachedObject;
            //if not instance of CustomInterpolator, then force
            //weblogic for some reason doesnt set the interpolator from validation.xml
            if (validatorFactory.getMessageInterpolator() instanceof CustomInterpolator == false) {
                validatorFactory = javax.validation.Validation.byDefaultProvider()
                        .configure()
                        .messageInterpolator(new CustomInterpolator())
                        .buildValidatorFactory();
                context.getExternalContext().getApplicationMap().put(VALIDATOR_FACTORY_KEY, validatorFactory);
            }
        }

        try {
            super.validate(context, component, value);
        } catch (ValidatorException ex) {

            ValueReference valueReference = getValueReference(context, component);
            List<FacesMessage> messages = new ArrayList<>();

            if (ex.getFacesMessages() == null || !ex.getFacesMessages().contains(ex.getFacesMessage())) {
                messages.add(ex.getFacesMessage());
            }

            if (ex.getFacesMessages() != null) {
                messages.addAll(ex.getFacesMessages());
            }

            if (DEBUG) {
                logger.log(Level.INFO, "Caught a ValidatorException. {0} messages.", messages.size());
            }

            for (FacesMessage facesMessage : messages) {
                if (DEBUG) {
                    logger.log(Level.INFO, "Message summary: {0}", facesMessage.getSummary());
                }
                String message = getMessage(facesMessage.getSummary(), valueReference);
                if (DEBUG) {
                    logger.log(Level.INFO, "Message resolved: {0}", message);
                }
                facesMessage.setSummary(message);
                facesMessage.setDetail(message);
            }

            throw new ValidatorException(messages);
        }

    }

    @Override
    public void validate(FacesContext context, UIComponent component, Object value) {

        Object cachedObject = context.getExternalContext().getApplicationMap().get(VALIDATOR_FACTORY_KEY);
        if (cachedObject instanceof ValidatorFactory) {
            ValidatorFactory validatorFactory = (ValidatorFactory) cachedObject;
            //if not instance of CustomInterpolator, then force
            //weblogic for some reason doesnt set the interpolator from validation.xml
            if (validatorFactory.getMessageInterpolator() instanceof CustomInterpolator == false) {
                validatorFactory = javax.validation.Validation.byDefaultProvider()
                        .configure()
                        .messageInterpolator(new CustomInterpolator())
                        .buildValidatorFactory();
                context.getExternalContext().getApplicationMap().put(VALIDATOR_FACTORY_KEY, validatorFactory);
            }
        }

        try {
            super.validate(context, component, value);
        } catch (ValidatorException ex) {

            ValueReference valueReference = getValueReference(context, component);
            List<FacesMessage> messages = new ArrayList<FacesMessage>();

            if (ex.getFacesMessages() == null || !ex.getFacesMessages().contains(ex.getFacesMessage())) {
                messages.add(ex.getFacesMessage());
            }

            if (ex.getFacesMessages() != null) {
                messages.addAll(ex.getFacesMessages());
            }

            if (DEBUG) {
                logger.log(Level.INFO, "Caught a ValidatorException. {0} messages.", messages.size());
            }

            for (FacesMessage facesMessage : messages) {
                if (DEBUG) {
                    logger.log(Level.INFO, "Message summary: {0}", facesMessage.getSummary());
                }
                String message = getMessage(facesMessage.getSummary(), valueReference);
                if (DEBUG) {
                    logger.log(Level.INFO, "Message resolved: {0}", message);
                }
                facesMessage.setSummary(message);
                facesMessage.setDetail(message);
            }

            throw new ValidatorException(messages);
        }

    }

Replace Generic With Diamond ArrayList<FacesMessage> with ArrayList<> in method public validate(context FacesContext, component UIComponent, value Object) : void from class com.xpert.core.validation.BeanValidator


    public static void validateUniqueFields(List<UniqueField> uniqueFields, Object object, BaseDAO baseDAO) throws UniqueFieldException {

        if (uniqueFields == null) {
            return;
        }

        UniqueFieldException exception = new UniqueFieldException();

        for (UniqueField uniqueField : uniqueFields) {
            List<Restriction> restrictions = new ArrayList<>();
            if (uniqueField.getRestrictions() != null && !uniqueField.getRestrictions().isEmpty()) {
                restrictions.addAll(uniqueField.getRestrictions());
            }
            if (uniqueField.getConstraints() != null) {
                for (String fieldName : uniqueField.getConstraints()) {
                    try {
                        Object value = PropertyUtils.getProperty(object, fieldName);
                        if (value != null && !value.toString().isEmpty()) {
                            restrictions.add(new Restriction(fieldName, value));
                        }
                    } catch (Exception ex) {
                        throw new RuntimeException(ex);
                    }
                }
            }
            if (!restrictions.isEmpty()) {
                Object id = EntityUtils.getId(object);
                if (id != null) {
                    restrictions.add(new Restriction(EntityUtils.getIdFieldName(object), RestrictionType.NOT_EQUALS, id));
                }
                if (baseDAO.count(restrictions) > 0) {
                    if (uniqueField.getMessage() != null && !uniqueField.getMessage().isEmpty()) {
                        exception.add(uniqueField.getMessage());
                    } else {
                        exception.setI18n(false);
                        exception.add(getValidationMessage(uniqueField, object));
                    }
                }
            }
        }
        exception.check();
    }

    public static void validateUniqueFields(List<UniqueField> uniqueFields, Object object, BaseDAO baseDAO) throws UniqueFieldException {

        if (uniqueFields == null) {
            return;
        }

        UniqueFieldException exception = new UniqueFieldException();

        for (UniqueField uniqueField : uniqueFields) {
            List<Restriction> restrictions = new ArrayList<Restriction>();
            if (uniqueField.getRestrictions() != null && !uniqueField.getRestrictions().isEmpty()) {
                restrictions.addAll(uniqueField.getRestrictions());
            }
            if (uniqueField.getConstraints() != null) {
                for (String fieldName : uniqueField.getConstraints()) {
                    try {
                        Object value = PropertyUtils.getProperty(object, fieldName);
                        if (value != null && !value.toString().isEmpty()) {
                            restrictions.add(new Restriction(fieldName, value));
                        }
                    } catch (Exception ex) {
                        throw new RuntimeException(ex);
                    }
                }
            }
            if (!restrictions.isEmpty()) {
                Object id = EntityUtils.getId(object);
                if (id != null) {
                    restrictions.add(new Restriction(EntityUtils.getIdFieldName(object), RestrictionType.NOT_EQUALS, id));
                }
                if (baseDAO.count(restrictions) > 0) {
                    if (uniqueField.getMessage() != null && !uniqueField.getMessage().isEmpty()) {
                        exception.add(uniqueField.getMessage());
                    } else {
                        exception.setI18n(false);
                        exception.add(getValidationMessage(uniqueField, object));
                    }
                }
            }
        }
        exception.check();
    }

Replace Generic With Diamond ArrayList<Restriction> with ArrayList<> in method public validateUniqueFields(uniqueFields List<UniqueField>, object Object, baseDAO BaseDAO) : void from class com.xpert.core.validation.UniqueFieldsValidation


    public void make() {
        selectedClasses = new ArrayList<>();
        for (String className : nameSelectedClasses) {
            try {
                selectedClasses.add(Class.forName(className, true, Thread.currentThread().getContextClassLoader()));
            } catch (ClassNotFoundException ex) {
                logger.log(Level.SEVERE, null, ex);
            }
        }
        mappedBeans = persistenceMappedBean.getMappedBeans(selectedClasses, configuration);
        load();
    }

    public void make() {
        selectedClasses = new ArrayList<Class>();
        for (String className : nameSelectedClasses) {
            try {
                selectedClasses.add(Class.forName(className, true, Thread.currentThread().getContextClassLoader()));
            } catch (ClassNotFoundException ex) {
                logger.log(Level.SEVERE, null, ex);
            }
        }
        mappedBeans = persistenceMappedBean.getMappedBeans(selectedClasses, configuration);
        load();
    }

Replace Generic With Diamond ArrayList<Class> with ArrayList<> in method public make() : void from class com.xpert.faces.bean.BeanMaker


    public ClassModel(String itemLabel, Restriction restriction, String order) {
        this.order = order;
        this.restrictions = new ArrayList<>();
        this.restrictions.add(restriction);
        this.itemLabel = itemLabel;
    }

    public ClassModel(String itemLabel, Restriction restriction, String order) {
        this.order = order;
        this.restrictions = new ArrayList<Restriction>();
        this.restrictions.add(restriction);
        this.itemLabel = itemLabel;
    }

Replace Generic With Diamond ArrayList<Restriction> with ArrayList<> in method public ClassModel(itemLabel String, restriction Restriction, order String) from class com.xpert.faces.bean.ClassModel


    public LocaleBean() {
        locale = FacesContext.getCurrentInstance().getApplication().getDefaultLocale();
        if (locale == null) {
            locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
        }
        locales = new ArrayList<>();
        Iterator<Locale> it = FacesContext.getCurrentInstance().getApplication().getSupportedLocales();
        while (it.hasNext()) {
            locales.add(it.next());
        }
    }

    public LocaleBean() {
        locale = FacesContext.getCurrentInstance().getApplication().getDefaultLocale();
        if (locale == null) {
            locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
        }
        locales = new ArrayList<Locale>();
        Iterator<Locale> it = FacesContext.getCurrentInstance().getApplication().getSupportedLocales();
        while (it.hasNext()) {
            locales.add(it.next());
        }
    }

Replace Generic With Diamond ArrayList<Locale> with ArrayList<> in method public LocaleBean() from class com.xpert.faces.bean.LocaleBean


    public GroupModel(String field, List value) {
        this.groupBy = field;
        this.value = value;
        this.itens = new ArrayList<>();
    }

    public GroupModel(String field, List value) {
        this.groupBy = field;
        this.value = value;
        this.itens = new ArrayList<GroupModelItem<K, V>>();
    }

Replace Generic With Diamond ArrayList<GroupModelItem<K,V>> with ArrayList<> in method public GroupModel(field String, value List) from class com.xpert.faces.component.group.model.GroupModel


    public void apply(FaceletContext faceletContext, UIComponent parent) throws IOException, FacesException, FaceletException, ELException {
        if (ComponentHandler.isNew(parent)) {

            //add restriction to request map
            ValueExpression addToVE = null;
            ValueExpression propertyVE = null;
            ValueExpression typeVE = null;
            ValueExpression ilikeVE = null;
            ValueExpression likeTypeVE = null;
            ValueExpression temporalTypeVE = null;
            ValueExpression renderedVE = null;
            ValueExpression castAsVE = null;

            //get value expressions
            if (addTo != null) {
                addToVE = addTo.getValueExpression(faceletContext, Object.class);
            }

            if (castAs != null) {
                castAsVE = castAs.getValueExpression(faceletContext, Object.class);
            }

            if (property != null) {
                propertyVE = property.getValueExpression(faceletContext, String.class);
            }

            if (type != null) {
                typeVE = type.getValueExpression(faceletContext, String.class);
                //validate
                String typeString = type.getValue(faceletContext);
                //if a type is informed, then validate the type
                if (typeString != null && !typeString.trim().isEmpty()) {
                    RestrictionType restrictionType = RestrictionType.getByAcronym(typeString);
                    if (restrictionType == null) {
                        throw new FacesException("Restriction type \"" + typeString + "\" not found. The supported types are: " + RestrictionType.getAcronymList());
                    }

                }
            }

            if (ilike != null) {
                ilikeVE = ilike.getValueExpression(faceletContext, Boolean.class);
            }

            if (likeType != null) {
                likeTypeVE = likeType.getValueExpression(faceletContext, String.class);

                //validate
                String typeString = likeType.getValue(faceletContext);
                //if a type is informed, then validate the type
                if (typeString != null) {
                    boolean found = false;
                    for (LikeType lt : LikeType.values()) {
                        if (lt.name().toLowerCase().equals(typeString)) {
                            found = true;
                        }
                    }
                    if (found == false) {
                        throw new FacesException("Like type \"" + typeString + "\" not found. The supported types are: " + LikeType.getNameList());
                    }

                }
            }

            if (temporalType != null) {
                temporalTypeVE = temporalType.getValueExpression(faceletContext, String.class);

                //validate
                String typeString = temporalType.getValue(faceletContext);
                //if a type is informed, then validate the type
                if (typeString != null) {
                    boolean found = false;
                    for (TemporalType tt : TemporalType.values()) {
                        if (tt.name().toLowerCase().equals(typeString)) {
                            found = true;
                        }
                    }
                    if (found == false) {
                        throw new FacesException("Restriction type \"" + typeString + "\" not found. The supported types are: time, timestamp, date");
                    }

                }
            }

            if(rendered != null){
                renderedVE = rendered.getValueExpression(faceletContext, Boolean.class);
            }

            //create component
            RestrictionComponent restrictionComponent = new RestrictionComponent(parent, addToVE, propertyVE, typeVE, ilikeVE, likeTypeVE, temporalTypeVE, renderedVE, castAsVE);

            Map<String, Object> requestMap = faceletContext.getFacesContext().getExternalContext().getRequestMap();
            List<RestrictionComponent> currentRestrictions = (List<RestrictionComponent>) requestMap.get(RestrictionCollector.RESTRICTIONS);
            if (currentRestrictions == null) {
                currentRestrictions = new ArrayList<>();
            }
            currentRestrictions.add(restrictionComponent);
            //add to requestmap
            requestMap.put(RestrictionCollector.RESTRICTIONS, currentRestrictions);

        }
    }

    public void apply(FaceletContext faceletContext, UIComponent parent) throws IOException, FacesException, FaceletException, ELException {
        if (ComponentHandler.isNew(parent)) {

            //add restriction to request map
            ValueExpression addToVE = null;
            ValueExpression propertyVE = null;
            ValueExpression typeVE = null;
            ValueExpression ilikeVE = null;
            ValueExpression likeTypeVE = null;
            ValueExpression temporalTypeVE = null;
            ValueExpression renderedVE = null;
            ValueExpression castAsVE = null;

            //get value expressions
            if (addTo != null) {
                addToVE = addTo.getValueExpression(faceletContext, Object.class);
            }

            if (castAs != null) {
                castAsVE = castAs.getValueExpression(faceletContext, Object.class);
            }

            if (property != null) {
                propertyVE = property.getValueExpression(faceletContext, String.class);
            }

            if (type != null) {
                typeVE = type.getValueExpression(faceletContext, String.class);
                //validate
                String typeString = type.getValue(faceletContext);
                //if a type is informed, then validate the type
                if (typeString != null && !typeString.trim().isEmpty()) {
                    RestrictionType restrictionType = RestrictionType.getByAcronym(typeString);
                    if (restrictionType == null) {
                        throw new FacesException("Restriction type \"" + typeString + "\" not found. The supported types are: " + RestrictionType.getAcronymList());
                    }

                }
            }

            if (ilike != null) {
                ilikeVE = ilike.getValueExpression(faceletContext, Boolean.class);
            }

            if (likeType != null) {
                likeTypeVE = likeType.getValueExpression(faceletContext, String.class);

                //validate
                String typeString = likeType.getValue(faceletContext);
                //if a type is informed, then validate the type
                if (typeString != null) {
                    boolean found = false;
                    for (LikeType lt : LikeType.values()) {
                        if (lt.name().toLowerCase().equals(typeString)) {
                            found = true;
                        }
                    }
                    if (found == false) {
                        throw new FacesException("Like type \"" + typeString + "\" not found. The supported types are: " + LikeType.getNameList());
                    }

                }
            }

            if (temporalType != null) {
                temporalTypeVE = temporalType.getValueExpression(faceletContext, String.class);

                //validate
                String typeString = temporalType.getValue(faceletContext);
                //if a type is informed, then validate the type
                if (typeString != null) {
                    boolean found = false;
                    for (TemporalType tt : TemporalType.values()) {
                        if (tt.name().toLowerCase().equals(typeString)) {
                            found = true;
                        }
                    }
                    if (found == false) {
                        throw new FacesException("Restriction type \"" + typeString + "\" not found. The supported types are: time, timestamp, date");
                    }

                }
            }

            if(rendered != null){
                renderedVE = rendered.getValueExpression(faceletContext, Boolean.class);
            }

            //create component
            RestrictionComponent restrictionComponent = new RestrictionComponent(parent, addToVE, propertyVE, typeVE, ilikeVE, likeTypeVE, temporalTypeVE, renderedVE, castAsVE);

            Map<String, Object> requestMap = faceletContext.getFacesContext().getExternalContext().getRequestMap();
            List<RestrictionComponent> currentRestrictions = (List<RestrictionComponent>) requestMap.get(RestrictionCollector.RESTRICTIONS);
            if (currentRestrictions == null) {
                currentRestrictions = new ArrayList<RestrictionComponent>();
            }
            currentRestrictions.add(restrictionComponent);
            //add to requestmap
            requestMap.put(RestrictionCollector.RESTRICTIONS, currentRestrictions);

        }
    }

Replace Generic With Diamond ArrayList<RestrictionComponent> with ArrayList<> in method public apply(faceletContext FaceletContext, parent UIComponent) : void from class com.xpert.faces.component.restriction.RestrictionTagHandler


    @SuppressWarnings("unchecked")
    private int saveMessages(final FacesContext facesContext)
    {
        List<FacesMessage> messages = new ArrayList<>();
        for (Iterator<FacesMessage> iter = facesContext.getMessages(null); iter.hasNext();)
        {
            messages.add(iter.next());
            iter.remove();
        }

        if (messages.size() == 0)
        {
            return 0;
        }

        Map<String, Object> sessionMap = facesContext.getExternalContext().getSessionMap();
        List<FacesMessage> existingMessages = (List<FacesMessage>) sessionMap.get(sessionToken);
        if (existingMessages != null)
        {
            existingMessages.addAll(messages);
        }
        else
        {
            sessionMap.put(sessionToken, messages);
        }
        return messages.size();
    }

    @SuppressWarnings("unchecked")
    private int saveMessages(final FacesContext facesContext)
    {
        List<FacesMessage> messages = new ArrayList<FacesMessage>();
        for (Iterator<FacesMessage> iter = facesContext.getMessages(null); iter.hasNext();)
        {
            messages.add(iter.next());
            iter.remove();
        }

        if (messages.size() == 0)
        {
            return 0;
        }

        Map<String, Object> sessionMap = facesContext.getExternalContext().getSessionMap();
        List<FacesMessage> existingMessages = (List<FacesMessage>) sessionMap.get(sessionToken);
        if (existingMessages != null)
        {
            existingMessages.addAll(messages);
        }
        else
        {
            sessionMap.put(sessionToken, messages);
        }
        return messages.size();
    }

Replace Generic With Diamond ArrayList<FacesMessage> with ArrayList<> in method private saveMessages(facesContext FacesContext) : int from class com.xpert.faces.listener.MultiPageMessagesSupport


    /**
     * @param filters Filters from "load" method
     * @return The filter map converted into "restrictions"
     */
    public List<Restriction> getRestrictionsFromFilterMap(Map filters) {

        List<Restriction> filterRestrictions = new ArrayList<>();

        if (filters != null && !filters.isEmpty()) {
            for (Entry e : ((Map<String, Object>) filters).entrySet()) {
                if (e.getValue() != null && !e.getValue().toString().isEmpty()) {
                    FilterByHandler filterByHandler = getFilterByHandler();
                    Restrictions restrictionsFromFilterByHandler = null;
                    if (filterByHandler != null) {
                        restrictionsFromFilterByHandler = filterByHandler.getFilterBy(e.getKey().toString(), e.getValue());
                    }
                    if (filterByHandler != null && restrictionsFromFilterByHandler != null && !restrictionsFromFilterByHandler.isEmpty()) {
                        filterRestrictions.addAll(restrictionsFromFilterByHandler);
                    } else {
                        if (debug) {
                            logger.log(Level.INFO, "Restriction added. Name: {0}, Value:  {1}", new Object[]{e.getKey(), e.getValue()});
                        }
                        //primefaces 5 can add custom types in filter not only String
                        String property = e.getKey().toString();
                        if (joinBuilder != null && joinBuilder.getRootAlias() != null) {
                            property = joinBuilder.getRootAlias() + "." + property;
                        }
                        if (e.getValue() instanceof String) {
                            filterRestrictions.add(new Restriction(property, RestrictionType.DATA_TABLE_FILTER, e.getValue()));
                        } else if (e.getValue() instanceof Object[]) {
                            if (((Object[]) e.getValue()).length > 0) {
                                //copy Array into List. (Arrays.asList din't work here)
                                List list = new ArrayList();
                                for (Object item : (Object[]) e.getValue()) {
                                    list.add(item);
                                }
                                filterRestrictions.add(new Restriction(property, RestrictionType.IN, list));
                            }
                        } else {
                            filterRestrictions.add(new Restriction(property, RestrictionType.EQUALS, e.getValue()));

                        }
                    }
                }
            }
        }
        return filterRestrictions;
    }

    /**
     * @param filters Filters from "load" method
     * @return The filter map converted into "restrictions"
     */
    public List<Restriction> getRestrictionsFromFilterMap(Map filters) {

        List<Restriction> filterRestrictions = new ArrayList<Restriction>();

        if (filters != null && !filters.isEmpty()) {
            for (Entry e : ((Map<String, Object>) filters).entrySet()) {
                if (e.getValue() != null && !e.getValue().toString().isEmpty()) {
                    FilterByHandler filterByHandler = getFilterByHandler();
                    Restrictions restrictionsFromFilterByHandler = null;
                    if (filterByHandler != null) {
                        restrictionsFromFilterByHandler = filterByHandler.getFilterBy(e.getKey().toString(), e.getValue());
                    }
                    if (filterByHandler != null && restrictionsFromFilterByHandler != null && !restrictionsFromFilterByHandler.isEmpty()) {
                        filterRestrictions.addAll(restrictionsFromFilterByHandler);
                    } else {
                        if (debug) {
                            logger.log(Level.INFO, "Restriction added. Name: {0}, Value:  {1}", new Object[]{e.getKey(), e.getValue()});
                        }
                        //primefaces 5 can add custom types in filter not only String
                        String property = e.getKey().toString();
                        if (joinBuilder != null && joinBuilder.getRootAlias() != null) {
                            property = joinBuilder.getRootAlias() + "." + property;
                        }
                        if (e.getValue() instanceof String) {
                            filterRestrictions.add(new Restriction(property, RestrictionType.DATA_TABLE_FILTER, e.getValue()));
                        } else if (e.getValue() instanceof Object[]) {
                            if (((Object[]) e.getValue()).length > 0) {
                                //copy Array into List. (Arrays.asList din't work here)
                                List list = new ArrayList();
                                for (Object item : (Object[]) e.getValue()) {
                                    list.add(item);
                                }
                                filterRestrictions.add(new Restriction(property, RestrictionType.IN, list));
                            }
                        } else {
                            filterRestrictions.add(new Restriction(property, RestrictionType.EQUALS, e.getValue()));

                        }
                    }
                }
            }
        }
        return filterRestrictions;
    }

Replace Generic With Diamond ArrayList<Restriction> with ArrayList<> in method public getRestrictionsFromFilterMap(filters Map) : List<Restriction> from class com.xpert.faces.primefaces.LazyDataModelImpl


    public List<Restriction> getCurrentQueryRestrictions() {
        List<Restriction> currentQueryRestrictions = new ArrayList<>();

        if (restrictions != null && !restrictions.isEmpty()) {
            currentQueryRestrictions.addAll(restrictions);
        }
        if (restriction != null) {
            currentQueryRestrictions.add(restriction);
        }
        //restrictions from filter
        if (currentFilters != null && !currentFilters.isEmpty()) {
            currentQueryRestrictions.addAll(getRestrictionsFromFilterMap(currentFilters));
        }
        return currentQueryRestrictions;
    }

    public List<Restriction> getCurrentQueryRestrictions() {
        List<Restriction> currentQueryRestrictions = new ArrayList<Restriction>();

        if (restrictions != null && !restrictions.isEmpty()) {
            currentQueryRestrictions.addAll(restrictions);
        }
        if (restriction != null) {
            currentQueryRestrictions.add(restriction);
        }
        //restrictions from filter
        if (currentFilters != null && !currentFilters.isEmpty()) {
            currentQueryRestrictions.addAll(getRestrictionsFromFilterMap(currentFilters));
        }
        return currentQueryRestrictions;
    }

Replace Generic With Diamond ArrayList<Restriction> with ArrayList<> in method public getCurrentQueryRestrictions() : List<Restriction> from class com.xpert.faces.primefaces.LazyDataModelImpl


    protected static String replaceParameters(String message, MessageInterpolator.Context context) {

        Matcher matcher = PATTERN.matcher(message);
        List<String> messageAttributes = new ArrayList<>();

        while (matcher.find()) {
            messageAttributes.add(matcher.group());
        }

        if (context != null && context.getConstraintDescriptor() != null && context.getConstraintDescriptor().getAttributes() != null) {
            for (String attribute : messageAttributes) {
                Object value = context.getConstraintDescriptor().getAttributes().get(attribute.replace("{", "").replace("}", ""));
                if (value != null) {
                    message = message.replace(attribute, value.toString());
                }
            }
        }

        return message;
    }

    protected static String replaceParameters(String message, MessageInterpolator.Context context) {

        Matcher matcher = PATTERN.matcher(message);
        List<String> messageAttributes = new ArrayList<String>();

        while (matcher.find()) {
            messageAttributes.add(matcher.group());
        }

        if (context != null && context.getConstraintDescriptor() != null && context.getConstraintDescriptor().getAttributes() != null) {
            for (String attribute : messageAttributes) {
                Object value = context.getConstraintDescriptor().getAttributes().get(attribute.replace("{", "").replace("}", ""));
                if (value != null) {
                    message = message.replace(attribute, value.toString());
                }
            }
        }

        return message;
    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method protected replaceParameters(message String, context MessageInterpolator.Context) : String from class com.xpert.i18n.CustomInterpolator


    public static List<Field> getDeclaredFields(Class clazz) {
        List<Field> fields = new ArrayList<>();
        for (Field field : clazz.getDeclaredFields()) {
            fields.add(field);
        }
        if (clazz.getSuperclass() != null && !clazz.getSuperclass().equals(Object.class)) {
            List<Field> superFields = getDeclaredFields(clazz.getSuperclass());
            if (superFields != null && !superFields.isEmpty()) {
                fields.addAll(superFields);
            }
        }
        return fields;
    }

    public static List<Field> getDeclaredFields(Class clazz) {
        List<Field> fields = new ArrayList<Field>();
        for (Field field : clazz.getDeclaredFields()) {
            fields.add(field);
        }
        if (clazz.getSuperclass() != null && !clazz.getSuperclass().equals(Object.class)) {
            List<Field> superFields = getDeclaredFields(clazz.getSuperclass());
            if (superFields != null && !superFields.isEmpty()) {
                fields.addAll(superFields);
            }
        }
        return fields;
    }

Replace Generic With Diamond ArrayList<Field> with ArrayList<> in method public getDeclaredFields(clazz Class) : List<Field> from class com.xpert.maker.BeanCreator


    public static Collection<Class> getReferencedClasses(List<Class> classes) {
        Set<Class> references = new HashSet<>();

        for (Class clazz : classes) {
            for (Field field : getDeclaredFields(clazz)) {

                if (!field.isAnnotationPresent(Transient.class)) {

                    if (field.getType().equals(Collection.class) || field.getType().equals(List.class) || field.getType().equals(Set.class)) {
                        ParameterizedType parameterizedType = (ParameterizedType) field.getGenericType();
                        if (parameterizedType.getActualTypeArguments() != null && parameterizedType.getActualTypeArguments().length > 0) {
                            Class<?> listType = (Class<?>) parameterizedType.getActualTypeArguments()[0];
                            references.add(listType);
                        }
                    } else if (field.getType().isEnum() || field.getType().isAnnotationPresent(Entity.class) || field.getType().isAnnotationPresent(Embeddable.class)) {
                        references.add(field.getType());
                    }
                }
            }
        }

        return references;
    }

    public static Collection<Class> getReferencedClasses(List<Class> classes) {
        Set<Class> references = new HashSet<Class>();

        for (Class clazz : classes) {
            for (Field field : getDeclaredFields(clazz)) {

                if (!field.isAnnotationPresent(Transient.class)) {

                    if (field.getType().equals(Collection.class) || field.getType().equals(List.class) || field.getType().equals(Set.class)) {
                        ParameterizedType parameterizedType = (ParameterizedType) field.getGenericType();
                        if (parameterizedType.getActualTypeArguments() != null && parameterizedType.getActualTypeArguments().length > 0) {
                            Class<?> listType = (Class<?>) parameterizedType.getActualTypeArguments()[0];
                            references.add(listType);
                        }
                    } else if (field.getType().isEnum() || field.getType().isAnnotationPresent(Entity.class) || field.getType().isAnnotationPresent(Embeddable.class)) {
                        references.add(field.getType());
                    }
                }
            }
        }

        return references;
    }

Replace Generic With Diamond HashSet<Class> with HashSet<> in method public getReferencedClasses(classes List<Class>) : Collection<Class> from class com.xpert.maker.BeanCreator


    public static Set<Class> getClassesForClassBean(List<Class> classes) {
        //set to evict duplicates
        Set<Class> allClasses = new HashSet<>();
        if (classes != null) {
            allClasses.addAll(classes);
            allClasses.addAll(getReferencedClasses(classes));
        }
        return allClasses;
    }

    public static Set<Class> getClassesForClassBean(List<Class> classes) {
        //set to evict duplicates
        Set<Class> allClasses = new HashSet<Class>();
        if (classes != null) {
            allClasses.addAll(classes);
            allClasses.addAll(getReferencedClasses(classes));
        }
        return allClasses;
    }

Replace Generic With Diamond HashSet<Class> with HashSet<> in method public getClassesForClassBean(classes List<Class>) : Set<Class> from class com.xpert.maker.BeanCreator


    public static String getClassBean(List<Class> classes, BeanConfiguration configuration) {
        try {
            Template template = BeanCreator.getTemplate("class-bean.ftl");
            StringWriter writer = new StringWriter();
            Map attributes = new HashMap();
            //set to evict duplicates
            Set<Class> allClasses = getClassesForClassBean(classes);
            attributes.put("classes", allClasses);
            attributes.put("configuration", configuration);
            attributes.put("package", configuration.getManagedBean() == null ? "" : configuration.getManagedBean());
            template.process(attributes, writer);

            writer.flush();
            writer.close();

            return writer.toString();
        } catch (IOException | TemplateException ex) {
            logger.log(Level.SEVERE, null, ex);
        }
        return "";
    }

    public static String getClassBean(List<Class> classes, BeanConfiguration configuration) {
        try {
            Template template = BeanCreator.getTemplate("class-bean.ftl");
            StringWriter writer = new StringWriter();
            Map attributes = new HashMap();
            //set to evict duplicates
            Set<Class> allClasses = getClassesForClassBean(classes);
            attributes.put("classes", allClasses);
            attributes.put("configuration", configuration);
            attributes.put("package", configuration.getManagedBean() == null ? "" : configuration.getManagedBean());
            template.process(attributes, writer);

            writer.flush();
            writer.close();

            return writer.toString();
        } catch (IOException ex) {
            logger.log(Level.SEVERE, null, ex);
        } catch (TemplateException ex) {
            logger.log(Level.SEVERE, null, ex);
        }
        return "";
    }

Merge Catch [catch(IOException ex), catch(TemplateException ex)] to catch(IOException|TemplateException ex) in method public getClassBean(classes List<Class>, configuration BeanConfiguration) : String from class com.xpert.maker.BeanCreator


    public static String getViewTemplate() {

        try {
            Template template = BeanCreator.getTemplate("view-template.ftl");
            StringWriter writer = new StringWriter();
            template.process(getDefaultParameters(), writer);
            writer.flush();
            writer.close();
            return writer.toString();
        } catch (IOException | TemplateException ex) {
            logger.log(Level.SEVERE, null, ex);
        }

        return "";

    }

    public static String getViewTemplate() {

        try {
            Template template = BeanCreator.getTemplate("view-template.ftl");
            StringWriter writer = new StringWriter();
            template.process(getDefaultParameters(), writer);
            writer.flush();
            writer.close();
            return writer.toString();
        } catch (IOException ex) {
            logger.log(Level.SEVERE, null, ex);
        } catch (TemplateException ex) {
            logger.log(Level.SEVERE, null, ex);
        }

        return "";

    }

Merge Catch [catch(IOException ex), catch(TemplateException ex)] to catch(IOException|TemplateException ex) in method public getViewTemplate() : String from class com.xpert.maker.BeanCreator


    public static void writeFile(String location, String fileName, String content, StringBuilder logBuilder) {
        if (location == null || location.isEmpty()) {
            return;
        }
        //create dir
        File dir = new File(location);
        dir.mkdirs();
        //create file
        File file = new File(location + File.separator + fileName);
        if (!file.exists()) {
            try (FileOutputStream outputStream = new FileOutputStream(file)) {
                log(logBuilder, "Writing file: " + fileName + " on dir: " + file.getAbsolutePath());
                try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream))) {
                    writer.write(content);
                }
            } catch (IOException ex) {
                log(logBuilder, "IOException: " + ex.getMessage() + ". More details see java log.");
                logger.log(Level.SEVERE, null, ex);
            }
        } else {
            log(logBuilder, "File: " + fileName + " already exists");
        }
    }

    public static void writeFile(String location, String fileName, String content, StringBuilder logBuilder) {
        if (location == null || location.isEmpty()) {
            return;
        }
        //create dir
        File dir = new File(location);
        dir.mkdirs();
        //create file
        File file = new File(location + File.separator + fileName);
        if (!file.exists()) {
            FileOutputStream outputStream;
            try {
                log(logBuilder, "Writing file: " + fileName + " on dir: " + file.getAbsolutePath());
                outputStream = new FileOutputStream(file);
                BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream));
                writer.write(content);
                writer.close();
                outputStream.close();
            } catch (IOException ex) {
                log(logBuilder, "IOException: " + ex.getMessage() + ". More details see java log.");
                logger.log(Level.SEVERE, null, ex);
            }
        } else {
            log(logBuilder, "File: " + fileName + " already exists");
        }
    }

Try With Resources try(FileOutputStream outputStream=new FileOutputStream(file)) in method public writeFile(location String, fileName String, content String, logBuilder StringBuilder) : void from class com.xpert.maker.BeanCreator


    public static String getMenubar(List<MappedBean> mappedBeans, String resourceBundle, BeanConfiguration configuration) {
        if (mappedBeans == null || mappedBeans.isEmpty()) {
            return null;
        }
        try {

            Template template = BeanCreator.getTemplate("menubar.ftl");
            StringWriter writer = new StringWriter();
            Map attributes = new HashMap();
            List<MenuModel> menus = new ArrayList<>();
            for (MappedBean mappedBean : mappedBeans) {
                String nameLower = StringUtils.getLowerFirstLetter(mappedBean.getEntityClass().getSimpleName());
                menus.add(new MenuModel("#{" + resourceBundle + "['menu." + nameLower + "']}",
                        "/" + getUrlForList(nameLower, mappedBean.getEntityClass().getSimpleName(), configuration) + ".jsf"));
            }
            attributes.put("menus", menus);
            template.process(attributes, writer);
            writer.flush();
            writer.close();
            return writer.toString();
        } catch (IOException ex) {
            logger.log(Level.SEVERE, null, ex);
        } catch (TemplateException ex) {
            logger.log(Level.SEVERE, null, ex);
        }

        return "";

    }

    public static String getMenubar(List<MappedBean> mappedBeans, String resourceBundle, BeanConfiguration configuration) {
        if (mappedBeans == null || mappedBeans.isEmpty()) {
            return null;
        }
        try {

            Template template = BeanCreator.getTemplate("menubar.ftl");
            StringWriter writer = new StringWriter();
            Map attributes = new HashMap();
            List<MenuModel> menus = new ArrayList<MenuModel>();
            for (MappedBean mappedBean : mappedBeans) {
                String nameLower = StringUtils.getLowerFirstLetter(mappedBean.getEntityClass().getSimpleName());
                menus.add(new MenuModel("#{" + resourceBundle + "['menu." + nameLower + "']}",
                        "/" + getUrlForList(nameLower, mappedBean.getEntityClass().getSimpleName(), configuration) + ".jsf"));
            }
            attributes.put("menus", menus);
            template.process(attributes, writer);
            writer.flush();
            writer.close();
            return writer.toString();
        } catch (IOException ex) {
            logger.log(Level.SEVERE, null, ex);
        } catch (TemplateException ex) {
            logger.log(Level.SEVERE, null, ex);
        }

        return "";

    }

Replace Generic With Diamond ArrayList<MenuModel> with ArrayList<> in method public getMenubar(mappedBeans List<MappedBean>, resourceBundle String, configuration BeanConfiguration) : String from class com.xpert.maker.BeanCreator


    public static List<Field> getFields(Class entity) {
        List<Field> fields = new ArrayList<>();
        for (Field field : entity.getDeclaredFields()) {
            if (isSerialVersionUID(field)) {
                continue;
            }
            fields.add(field);
        }
        if (entity.getSuperclass() != null && !entity.getSuperclass().equals(Object.class)) {
            fields.addAll(getFields(entity.getSuperclass()));
        }
        return fields;
    }

    public static List<Field> getFields(Class entity) {
        List<Field> fields = new ArrayList<Field>();
        for (Field field : entity.getDeclaredFields()) {
            if (isSerialVersionUID(field)) {
                continue;
            }
            fields.add(field);
        }
        if (entity.getSuperclass() != null && !entity.getSuperclass().equals(Object.class)) {
            fields.addAll(getFields(entity.getSuperclass()));
        }
        return fields;
    }

Replace Generic With Diamond ArrayList<Field> with ArrayList<> in method public getFields(entity Class) : List<Field> from class com.xpert.maker.BeanCreator