Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(kernel): annotate implemented interfaces on "ObjRef"s #825

Merged
merged 26 commits into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
00fa430
feat: annotate implemented interfaces on "ObjRef"s
RomainMuller Sep 26, 2019
9eacf3c
WIP
RomainMuller Sep 30, 2019
62bbf5c
WIP progress
RomainMuller Oct 4, 2019
aad06b8
finished fixing java
RomainMuller Oct 7, 2019
64b205b
fixup regression test expectations
RomainMuller Oct 8, 2019
1e11b33
fix python runtime
RomainMuller Oct 8, 2019
5f93693
fixup licensing info in NuGet packages
RomainMuller Oct 10, 2019
a71a418
improve NuGet package metadata
RomainMuller Oct 10, 2019
c601bc5
fix dotnet runtime
RomainMuller Oct 14, 2019
b07d21e
fixup unit tests
RomainMuller Oct 14, 2019
7499a01
Merge remote-tracking branch 'origin/master' into rmuller/fix-object-bug
RomainMuller Oct 15, 2019
ab176e5
Merge remote-tracking branch 'origin/master' into rmuller/fix-object-bug
RomainMuller Oct 16, 2019
3661615
Merge branch 'master' into rmuller/fix-object-bug
RomainMuller Oct 17, 2019
05c9e6b
Merge remote-tracking branch 'origin/master' into rmuller/fix-object-bug
RomainMuller Oct 17, 2019
49e5297
Merge remote-tracking branch 'origin/rmuller/fix-object-bug' into rmu…
RomainMuller Oct 17, 2019
27b5f8d
minor style fixes
RomainMuller Oct 18, 2019
db831aa
Merge branch 'master' into rmuller/fix-object-bug
RomainMuller Oct 22, 2019
271121e
some minor tuning
RomainMuller Oct 23, 2019
f015570
Merge remote-tracking branch 'origin/master' into rmuller/fix-object-bug
RomainMuller Oct 24, 2019
d2c11f0
fixup expecations
RomainMuller Oct 24, 2019
5cea023
Merge remote-tracking branch 'origin/master' into rmuller/fix-object-bug
RomainMuller Oct 29, 2019
a3ffd12
stop using deprecated API
RomainMuller Oct 29, 2019
45af794
add some test coverage
RomainMuller Oct 29, 2019
a7f445f
Merge branch 'master' into rmuller/fix-object-bug
RomainMuller Oct 29, 2019
bf8800f
fix test I forgot to update as I changed the code
RomainMuller Oct 29, 2019
997afb2
Merge remote-tracking branch 'origin/master' into rmuller/fix-object-bug
RomainMuller Oct 29, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"bump": "bash scripts/bump.sh",
"fetch-dotnet-snk": "bash scripts/fetch-dotnet-snk.sh",
"package": "bash scripts/package.sh",
"test": "lerna run test --stream"
"test": "lerna run test --stream",
"test:update": "UPDATE_DIFF=1 lerna run test --stream"
},
"devDependencies": {
"@types/node": "^10.14.22",
Expand Down
3 changes: 2 additions & 1 deletion packages/jsii-calc-base-of-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"types": "lib/index.d.ts",
"scripts": {
"build": "jsii",
"test": "diff-test test/assembly.jsii .jsii"
"test": "diff-test test/assembly.jsii .jsii",
"test:update": "npm run build && UPDATE_DIFF=1 npm run test"
},
"devDependencies": {
"jsii": "^0.19.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/jsii-calc-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"types": "lib/index.d.ts",
"scripts": {
"build": "jsii",
"test": "diff-test test/assembly.jsii .jsii"
"test": "diff-test test/assembly.jsii .jsii",
"test:update": "npm run build && UPDATE_DIFF=1 npm run test"
},
"dependencies": {
"@scope/jsii-calc-base-of-base": "^0.19.0"
Expand Down
3 changes: 2 additions & 1 deletion packages/jsii-calc-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"types": "lib/index.d.ts",
"scripts": {
"build": "jsii",
"test": "diff-test test/assembly.jsii .jsii"
"test": "diff-test test/assembly.jsii .jsii",
"test:update": "npm run build && UPDATE_DIFF=1 npm run test"
},
"dependencies": {
"@scope/jsii-calc-base": "^0.19.0"
Expand Down
24 changes: 22 additions & 2 deletions packages/jsii-calc/lib/compliance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1438,7 +1438,7 @@ export class EraseUndefinedHashValues {
/**
* We expect "prop2" to be erased
*/
public static prop2IsUndefined(): any {
public static prop2IsUndefined(): { [key: string]: any } {
return {
prop1: 'value1',
prop2: undefined
Expand All @@ -1448,7 +1448,7 @@ export class EraseUndefinedHashValues {
/**
* We expect "prop1" to be erased
*/
public static prop1IsNull(): any {
public static prop1IsNull(): { [key: string]: any } {
return {
prop1: null,
prop2: 'value2'
Expand Down Expand Up @@ -1900,3 +1900,23 @@ export class OverridableProtectedMember {
return this.overrideReadOnly + this.overrideReadWrite;
}
}

/**
* We can return an anonymous interface implementation from an override without losing the interface
* declarations.
*/
export interface IAnonymousImplementationProvider {
provide(): IAnonymouslyImplementMe;
}
export class AnonymousImplementationProvider implements IAnonymousImplementationProvider {
public provide(): IAnonymouslyImplementMe {
return {
value: 1337,
verb() { return 'to implement'; },
};
}
}
export interface IAnonymouslyImplementMe {
value: number;
verb(): string;
}
130 changes: 127 additions & 3 deletions packages/jsii-calc/test/assembly.jsii
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,41 @@
],
"name": "AllowedMethodNames"
},
"jsii-calc.AnonymousImplementationProvider": {
"assembly": "jsii-calc",
"docs": {
"stability": "experimental"
},
"fqn": "jsii-calc.AnonymousImplementationProvider",
"initializer": {},
"interfaces": [
"jsii-calc.IAnonymousImplementationProvider"
],
"kind": "class",
"locationInModule": {
"filename": "lib/compliance.ts",
"line": 1911
},
"methods": [
{
"docs": {
"stability": "experimental"
},
"locationInModule": {
"filename": "lib/compliance.ts",
"line": 1912
},
"name": "provide",
"overrides": "jsii-calc.IAnonymousImplementationProvider",
"returns": {
"type": {
"fqn": "jsii-calc.IAnonymouslyImplementMe"
}
}
}
],
"name": "AnonymousImplementationProvider"
},
"jsii-calc.AsyncVirtualMethods": {
"assembly": "jsii-calc",
"docs": {
Expand Down Expand Up @@ -3318,7 +3353,12 @@
"name": "prop1IsNull",
"returns": {
"type": {
"primitive": "any"
"collection": {
"elementtype": {
"primitive": "any"
},
"kind": "map"
}
}
},
"static": true
Expand All @@ -3335,7 +3375,12 @@
"name": "prop2IsUndefined",
"returns": {
"type": {
"primitive": "any"
"collection": {
"elementtype": {
"primitive": "any"
},
"kind": "map"
}
}
},
"static": true
Expand Down Expand Up @@ -3790,6 +3835,85 @@
],
"name": "GreetingAugmenter"
},
"jsii-calc.IAnonymousImplementationProvider": {
"assembly": "jsii-calc",
"docs": {
"stability": "experimental",
"summary": "We can return an anonymous interface implementation from an override without losing the interface declarations."
},
"fqn": "jsii-calc.IAnonymousImplementationProvider",
"kind": "interface",
"locationInModule": {
"filename": "lib/compliance.ts",
"line": 1908
},
"methods": [
{
"abstract": true,
"docs": {
"stability": "experimental"
},
"locationInModule": {
"filename": "lib/compliance.ts",
"line": 1909
},
"name": "provide",
"returns": {
"type": {
"fqn": "jsii-calc.IAnonymouslyImplementMe"
}
}
}
],
"name": "IAnonymousImplementationProvider"
},
"jsii-calc.IAnonymouslyImplementMe": {
"assembly": "jsii-calc",
"docs": {
"stability": "experimental"
},
"fqn": "jsii-calc.IAnonymouslyImplementMe",
"kind": "interface",
"locationInModule": {
"filename": "lib/compliance.ts",
"line": 1919
},
"methods": [
{
"abstract": true,
"docs": {
"stability": "experimental"
},
"locationInModule": {
"filename": "lib/compliance.ts",
"line": 1921
},
"name": "verb",
"returns": {
"type": {
"primitive": "string"
}
}
}
],
"name": "IAnonymouslyImplementMe",
"properties": [
{
"abstract": true,
"docs": {
"stability": "experimental"
},
"locationInModule": {
"filename": "lib/compliance.ts",
"line": 1920
},
"name": "value",
"type": {
"primitive": "number"
}
}
]
},
"jsii-calc.IAnotherPublicInterface": {
"assembly": "jsii-calc",
"docs": {
Expand Down Expand Up @@ -9699,5 +9823,5 @@
}
},
"version": "0.19.0",
"fingerprint": "KFKFyrJ+3+cfNKWPiNetngWkPFI32ydxfJyaR43/wDI="
"fingerprint": "OpxBghTomKWICGI/VfSJmwyqks2F/envRslx0JSxGyU="
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Amazon.JSII.JsonModel.Api
{
[JsonDictionary]
public class ObjectReference : JsonDictionaryBase<string, string>
public class ObjectReference : JsonDictionaryBase<string, object>
{
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@

[assembly: CollectionBehavior(DisableTestParallelization = true)]

#pragma warning disable CS0612

namespace Amazon.JSII.Runtime.IntegrationTests
{
/// <summary>
/// Ported from packages/jsii-java-runtime/src/test/java/org/jsii/testing/ComplianceTest.java.
/// </summary>
public class ComplianceTests : IClassFixture<ServiceContainerFixture>
public sealed class ComplianceTests : IClassFixture<ServiceContainerFixture>
{
class RuntimeException : Exception
{
Expand Down Expand Up @@ -127,12 +129,18 @@ public void DynamicTypes()
Assert.Equal(UnixEpoch.AddSeconds(1234), types.AnyProperty);

// json (notice that when deserialized, it is deserialized as a map).
types.AnyProperty = new JObject(new JProperty("Goo",
new JArray(
"Hello",
new JObject(new JProperty("World", 123))
)
));
types.AnyProperty = new Dictionary<string, object>
{
{ "Goo", new object[]
{
"Hello",
new Dictionary<string, object>
{
{ "World", 123 }
}
}
}
};
var @object = (IDictionary<string, object>) types.AnyProperty;
var array = (object[]) @object["Goo"];
var innerObject = (IDictionary<string, object>) array[1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Amazon.JSII.Runtime.IntegrationTests
{
public class ServiceContainerFixture : IDisposable
public sealed class ServiceContainerFixture : IDisposable
{
public ServiceContainerFixture()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Amazon.JSII.Runtime.IntegrationTests
{
public class XUnitLoggerFactory : ILoggerFactory
public sealed class XUnitLoggerFactory : ILoggerFactory
{
readonly ITestOutputHelper _output;

Expand All @@ -27,7 +27,7 @@ public void Dispose()
}
}

public class XUnitLogger : ILogger, IDisposable
public sealed class XUnitLogger : ILogger, IDisposable
{
readonly ITestOutputHelper _output;
readonly string _categoryName;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
using Xunit;
using System.Runtime.CompilerServices;
using Castle.Core.Internal;
using Xunit;

// Each test in this assembly overrides the the global service provider, so they can't be run in parallel.
[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)]

[assembly:InternalsVisibleTo(InternalsVisible.ToDynamicProxyGenAssembly2)]
Loading