GithubHelp home page GithubHelp logo

bindgen's People

Contributors

davidshepherdson avatar florianlacreuse avatar gsmet avatar ivaynberg avatar julien-gonzalez avatar lalmeras avatar margotpiva avatar nfekete avatar selckin avatar yrodiere avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

nfekete

bindgen's Issues

ft-lambda: consider using transient sub-bindings and/or fix hashCode/equals

Using transient sub-binding may be an interesting trick for Serializable behavior. It should not trigger any regression, and enhance serialization performance.

Maybe allowing to use a Binding registry (at least for rootless bindings) can be interesting.

We should at least a better equals/hashCode implementation (as for the moment two bindings for the same class are not instance-equal after a deserialization).

Generator doesn't pick up bindgen.properties when compilation path contains spaces

Code uses .toUri(), which converts spaces in the path to %20 escape codes, which are not de-escaped later when they're used as File paths. Problematic code:

FileObject dummyFileObject = env.getFiler().getResource(location, "", "dummy.txt");
dummyPath = dummyFileObject.toUri().toString().replaceAll("file:", "");
} catch (IOException e1) {
return null;
}
// Walk up looking for a bindgen.properties
File current = new File(dummyPath).getParentFile();
while (current != null) {
File possible = new File(current, fileName);
if (possible.exists()) {
return possible;
}
current = current.getParentFile();
}

There might be other characters besides spaces in the URI spec that would get escaped. It's probably better to stick with URIs and try to resolve the config file against URIs all the way up to the root of the filesystem (if we're to keep looking for bindgen.properties up to the filesystem root, which is questionable).

ft-lambda: handle already used R, P, T generic placeholders

For now, bindgen does not handle already used generic placeholders.

If we bind a GenericClass<P>, it fails because we use P placeholder twice (one from the bound class, one from the binding).

[edited 29.11.2018 to escape tags, so that issue can be read]

4.0.0 : migration guide

Need to be done to migrate toward ft-lambda:

  • update bindgen version
  • update bindgen-java version
  • replace references to AbstractBinding (or any overriden superclass) with BindingRoot (or any other interface). As AbstractBinding generics are changed, all references may be broken.
  • for example, replace AbstractCoreBinding by ICoreBinding (bindgen-java example)
  • if a custom superclass is used in your project:
    • replace <R, T> generics by <R, P, T>
    • add constructors from superclass (AbstractBinding) calling super(...) constructor

About <R, T> -> <R, P, T>: before lambda, information about parent binding were known by the fact the MyBinding was an inner class. With lambda, Type Binding is completely independant from parent Binding. So we need to inject some more information, like P, the type of the parent binding.

P allow to use type-constrained Getter and Setter.

ft-lambda: handle generic types

Current behavior: when target type is generic, we use plain old inner binding classes.

We should move to lambda expressions.

Two cases must be handled:

  • raw type; binding to a private Map field; for example
  • anonymous constrained type; binding to a private Map<? extends K, V> or private Map<K, ? extends K> field or private Map<? extends K, ? extends V> field
  • anonymous unconstrained type; binding to a private Map<?, V> or private Map<K, ?> field or private Map<?, ?> field

For raw type, we need to build a custom TypeRawBindingPath<R, P, T> extends AbstractBinding<R, P, T, Type> as a binding base class.

Not sure if constrained and unconstrained types are really different cases.

Use method reference instead of lambda

Lambda expression with getter method (x) -> x.getAttribute() can be replaced by method reference (ObjectType::getAttribute).

See what is possible / needed for callable bindings.

ft-lambda: master issue

ft-lambda feature is a rewrite of bindgen to use lambda expression instead of inner private classes. One goal of this rewrite is to get rid of all the *$Binding.class that can slow down compilation and IDE.

We also take the occasion to do a full cleanup of code and prospect some new feature (advanced configuration).

Type annotations are not handled correctly

In JDK 8 ElementType.TYPE_USE got introduced which makes it possible to annotate a type on type use. Type annotations like @Nullable, @NotNull etc. are prime examples of this. Bindgen doesn't handle these cases correctly when run through javac, because AnnotatedType.toString() used at

this.name = new ClassName(this.type.toString());
in javac returns a similar string:

(@TypeAnnotation :: TypeName)

which is unexpected by the processor, and therefore generates invalid java code. Under Eclipse Compiler for Java, it happens to run correctly, because of a different toString() implementation on AnnotatedType that returns only the type name.

ft-lambda: correctly handle ContainerBinding

ContainerBinding is handled on inner-class ; we need to correctly implement it with lambda bindings.

We can do:

  • drop interface support and use a boolean noarg method: public boolean isContainer()
  • move implements ContainerBinding on the *BindingPath class.

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.