All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.windup.decompiler.api.DecompilationResult Maven / Gradle / Ivy

The newest version!
package org.jboss.windup.decompiler.api;

import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * Keeps a count of successful decompilations and list of failed ones, in the form of an exception with String path and cause exception.
 *
 * @author Ondrej Zizka
 * @author Lincoln Baxter, III
 */
public class DecompilationResult {
    private final List failed = Collections.synchronizedList(new LinkedList());
    private final Map decompiledFiles = Collections.synchronizedMap(new HashMap());

    public void addDecompiled(List sourceClassPaths, String decompiledJavaPath) {
        String mainClassPath = null;
        for (String inputPath : sourceClassPaths) {
            if (!inputPath.contains("$")) {
                mainClassPath = inputPath;
            }
        }
        if (mainClassPath == null) {
            mainClassPath = sourceClassPaths.get(0);
        }
        this.decompiledFiles.put(mainClassPath, decompiledJavaPath);
    }

    public Map getDecompiledFiles() {
        return this.decompiledFiles;
    }

    public void addFailure(DecompilationFailure failure) {
        this.failed.add(failure);
    }

    public List getFailures() {
        return Collections.unmodifiableList(this.failed);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy