Git Product home page Git Product logo

imc's People

Contributors

picadoh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

imc's Issues

CompilerException explicit handling

Based on the following two observations:

  1. The method public CompilationPackage compile(Map<String, String> classesToCompile) throws CompilerException of the class InMemoryCompiler declares that throws that Exception, therefore enforces to be handled explictly. Of course same applies to singleCompile

  2. In the tl;dr use case this exception is not handled, probably delegated to the main(String[] args) method or a unit test

Three proposals for a more flexible (end user point of view) approach, the three of them imply removing the explicit throws of the methods:

  1. Provide a null-like CompilationPackage so that BaseCompilationPackage is an interface that is implemented by NullCompilationPackage and CompilationPackage (say).

  2. Provide a way to access the compilationReport in the CompilationPackage so that the user of the compiler can decide what to do with the CompilationPackage result.

  3. A combination of both 1 and 2.

A use case is an interface declaring a single method such as:

public interface CompilationPackageGenerator<T> {
    CompilationPackage compile (T t);
}

whose implementation may be

@Override
public CompilationPackage compile(Foo foo)
{
	HashMap<String, String> classes = irrelevantSourceCodeSupplier(foo);
	try
	{
		return inMemoryCompiler.compile(classes);
	}
	catch (InMemoryCompiler.CompilerException e)
	{
		e.printStackTrace();
	}	
	return null;
}

The return null is the part that lead me to open this ticket. I don't want to add throws CompileException to the interface.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.