Coder Social home page Coder Social logo

hypo's People

Contributors

denwav avatar jpenilla avatar machine-maker avatar maestro-denery avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hypo's Issues

BridgeMethodHydrator does not take into account synthetics on sub classes

Synthetic methods can be generated on subclasses, but then point to a method on the superclass. The invoke instruction used is the INVOKESPECIAL which currently the BridgeMethodHydrator treats as invalid, and so the method isn't hydrated properly.

There is also a check to make sure the class names are the same which isn't required.

And this also will probably requiring changing the HypoHydration.SYNTHETIC_SOURCE to be able to hold multiple methods, as there can be more than 1 synthetic bridge pointing to the same method.

HydrationProvider target type checks are reversed

When checking if a hydration provider applies to an impl of ClassData, FieldData, or MethodData, the check is reversed where it currently checks if the target class supplied by the HydrationProvider extends the method's actual class.

It should instead of the method's actual class extends the target class from the HydrationProvider.

LocalClassHydrator assumes incorrect order for fields

In determining captured values in the LocalClassHydrator, it assumes an incorrect order of fields, breaking out a loop to collect fields before all captured values have been collected.

class Demo {

	Demo(String arg1, String arg2) {
		
		class Other {
			private final String innerValue = "test";

			public String toString() {
				return arg2 + this.innerValue;
			}
		}

		new Other().toString();
	}
}

The above example produces a list of fields that begins with the "innerValue" field, then the 1 val$arg2 field, then the this$0 field.

LambdaCallHydrator incorrect param lvt indicies when param comes from field

The LambdaCallHydrator doesn't properly capture param lvt indicies if one of the parameters comes from a field node. Now usually this isn't the case, but it seems to be in the following situation.

abstract class AbstractClass {
	abstract Supplier<String> get(String arg);
}

class OuterClass {
	
	AbstractClass create(final String input) {
		final String value = input + "other";
		return new AbstractClass() {
			@Override
			Supplier<String> get(String arg) {
				return () -> value + arg;
			}
		}
	}
}

In this example, the lambda at OuterClass$1$lambda$create$0 (I think that's the correct name it'd have) or the one on being returned from the overriden method won't have the "arg" param marked as captured.

The issue comes from the logic collecting the param indicies. If it encounters a non var insn it breaks out of the loop, not completing the collection so an empty array is set in the LambdaCall object.

CopyMappingsDown applies mappings to implicit params

The CopyMappingsDown mappings change contributor doesn't check to make sure the parameter for which it is applying mappings would actually have a mapping.

class ParentClass {
	static class InnerStaticClass {
		InnerStaticClass(ParentClass parent, double value) {
		}
	}
}

class ChildClass extends ParentClass {
	class InnerClass extends ParentClass.InnerStaticClass {
		InnerClass(double value) {
			super(ChildClass.this, value);
		}
	}
}

The above example, if provided with mappings only for ParentClass$InnerStaticClass#<init> would apply 2 parameter mappings to ChildClass$InnerClass#<init>, the double param's mappings as well as the implicit ParentClass parameter.

I assume this is also an issue for any captured variables that would be in the constructor of a method-local class.

Tests I wrote to demo the issue: https://pastes.dev/BMugODf0zE

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.