diff options
author | Siva Velusamy <vsiva@google.com> | 2014-01-27 18:28:42 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-01-27 18:28:43 +0000 |
commit | ba227d7969596f4d9f674ecde91c6109d5a473b5 (patch) | |
tree | ca44f9b480b0215d06933a99c5489fa33fc3f16e /testData | |
parent | ff3d1f80f9ece867dcf13218392e684f27226ebf (diff) | |
parent | e1785e0c6f40e33787a3c7b0fcff32f568243937 (diff) | |
download | cloud-ba227d7969596f4d9f674ecde91c6109d5a473b5.tar.gz |
Merge "In the Constructor Inspection, check that an endpoint class muts have a public nullary constructor. An endpoint class can have multiple constructors as long as one of them is a public nullary constructor." into idea133
Diffstat (limited to 'testData')
17 files changed, 242 insertions, 41 deletions
diff --git a/testData/inspections/constructorInspectionTest/classWithConstructorWithArgument/expected.xml b/testData/inspections/constructorInspectionTest/classWithConstructorWithArgument/expected.xml new file mode 100644 index 0000000..29e7dd1 --- /dev/null +++ b/testData/inspections/constructorInspectionTest/classWithConstructorWithArgument/expected.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright (C) 2014 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<problems> + <problem> + <file>test.java</file> + <line>20</line> + <description>Each class that is within an API must have a public nullary constructor.</description> + </problem> +</problems>
\ No newline at end of file diff --git a/testData/inspections/constructorInspectionTest/classWithConstructorWithArgument/src/test.java b/testData/inspections/constructorInspectionTest/classWithConstructorWithArgument/src/test.java new file mode 100644 index 0000000..2ce222e --- /dev/null +++ b/testData/inspections/constructorInspectionTest/classWithConstructorWithArgument/src/test.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.app; + +import com.google.api.server.spi.config.Api; + +@Api +public class Foo { + public Foo (String name) {} +}
\ No newline at end of file diff --git a/testData/inspections/constructorInspectionTest/classWithNoConstructor/expected.xml b/testData/inspections/constructorInspectionTest/classWithNoConstructor/expected.xml new file mode 100644 index 0000000..c8a109a --- /dev/null +++ b/testData/inspections/constructorInspectionTest/classWithNoConstructor/expected.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright (C) 2014 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<problems> +</problems>
\ No newline at end of file diff --git a/testData/inspections/constructorInspectionTest/classWithNoConstructor/src/test.java b/testData/inspections/constructorInspectionTest/classWithNoConstructor/src/test.java new file mode 100644 index 0000000..77cc55a --- /dev/null +++ b/testData/inspections/constructorInspectionTest/classWithNoConstructor/src/test.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.app; + +import com.google.api.server.spi.config.Api; + +@Api +public class Foo { + +}
\ No newline at end of file diff --git a/testData/inspections/constructorInspectionTest/classWithPrivateConstructor/expected.xml b/testData/inspections/constructorInspectionTest/classWithPrivateConstructor/expected.xml new file mode 100644 index 0000000..24f3c0f --- /dev/null +++ b/testData/inspections/constructorInspectionTest/classWithPrivateConstructor/expected.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright (C) 2014 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<problems> + <problem> + <file>test.java</file> + <line>5</line> + <description>Each class that is within an API must have a public nullary constructor.</description> + </problem> +</problems>
\ No newline at end of file diff --git a/testData/inspections/constructorInspectionTest/privateConstructor/src/test.java b/testData/inspections/constructorInspectionTest/classWithPrivateConstructor/src/test.java index bd6fc33..bd6fc33 100644 --- a/testData/inspections/constructorInspectionTest/privateConstructor/src/test.java +++ b/testData/inspections/constructorInspectionTest/classWithPrivateConstructor/src/test.java diff --git a/testData/inspections/constructorInspectionTest/classWithPublicNullaryConstructor/expected.xml b/testData/inspections/constructorInspectionTest/classWithPublicNullaryConstructor/expected.xml new file mode 100644 index 0000000..c8a109a --- /dev/null +++ b/testData/inspections/constructorInspectionTest/classWithPublicNullaryConstructor/expected.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright (C) 2014 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<problems> +</problems>
\ No newline at end of file diff --git a/testData/inspections/constructorInspectionTest/classWithPublicNullaryConstructor/src/test.java b/testData/inspections/constructorInspectionTest/classWithPublicNullaryConstructor/src/test.java new file mode 100644 index 0000000..f20c45a --- /dev/null +++ b/testData/inspections/constructorInspectionTest/classWithPublicNullaryConstructor/src/test.java @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.app; + +import com.google.api.server.spi.config.Api; + +@Api +public class Foo { + public Foo () {} +}
\ No newline at end of file diff --git a/testData/inspections/constructorInspectionTest/constructorWithArgument/expected.xml b/testData/inspections/constructorInspectionTest/constructorWithArgument/expected.xml deleted file mode 100644 index 96f8179..0000000 --- a/testData/inspections/constructorInspectionTest/constructorWithArgument/expected.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<problems> - <problem> - <file>test.java</file> - <line>11</line> - <description>Each class that is within an API must have a public nullary constructor.</description> - </problem> -</problems>
\ No newline at end of file diff --git a/testData/inspections/constructorInspectionTest/constructorWithArgument/src/test.java b/testData/inspections/constructorInspectionTest/constructorWithArgument/src/test.java deleted file mode 100644 index 32888ad..0000000 --- a/testData/inspections/constructorInspectionTest/constructorWithArgument/src/test.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.example.app; - -import com.google.api.server.spi.config.Api; - -import java.lang.String; - - -@Api -public class Foo { - String name; - public Foo (String name) { - this.name = name; - } -}
\ No newline at end of file diff --git a/testData/inspections/constructorInspectionTest/multipleConstructorsIncludingPublicNullary/expected.xml b/testData/inspections/constructorInspectionTest/multipleConstructorsIncludingPublicNullary/expected.xml new file mode 100644 index 0000000..c8a109a --- /dev/null +++ b/testData/inspections/constructorInspectionTest/multipleConstructorsIncludingPublicNullary/expected.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright (C) 2014 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<problems> +</problems>
\ No newline at end of file diff --git a/testData/inspections/constructorInspectionTest/multipleConstructorsIncludingPublicNullary/src/test.java b/testData/inspections/constructorInspectionTest/multipleConstructorsIncludingPublicNullary/src/test.java new file mode 100644 index 0000000..f170fe7 --- /dev/null +++ b/testData/inspections/constructorInspectionTest/multipleConstructorsIncludingPublicNullary/src/test.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.app; + +import com.google.api.server.spi.config.Api; + +@Api +public class Foo { + private Foo (Boolean boo) {} + public Foo() {} + public Foo(String name){} +}
\ No newline at end of file diff --git a/testData/inspections/constructorInspectionTest/multipleConstructorsWithoutPublicNullary/expected.xml b/testData/inspections/constructorInspectionTest/multipleConstructorsWithoutPublicNullary/expected.xml new file mode 100644 index 0000000..29e7dd1 --- /dev/null +++ b/testData/inspections/constructorInspectionTest/multipleConstructorsWithoutPublicNullary/expected.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ~ Copyright (C) 2014 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<problems> + <problem> + <file>test.java</file> + <line>20</line> + <description>Each class that is within an API must have a public nullary constructor.</description> + </problem> +</problems>
\ No newline at end of file diff --git a/testData/inspections/constructorInspectionTest/multipleConstructorsWithoutPublicNullary/src/test.java b/testData/inspections/constructorInspectionTest/multipleConstructorsWithoutPublicNullary/src/test.java new file mode 100644 index 0000000..9db0b21 --- /dev/null +++ b/testData/inspections/constructorInspectionTest/multipleConstructorsWithoutPublicNullary/src/test.java @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.example.app; + +import com.google.api.server.spi.config.Api; + +@Api +public class Foo { + private Foo (String boo) {} + public Foo (String boo1, String boo2) {} + public Foo (Boolean hasBoo) {} +}
\ No newline at end of file diff --git a/testData/inspections/constructorInspectionTest/nullaryConstructor/expected.xml b/testData/inspections/constructorInspectionTest/nullaryConstructor/expected.xml deleted file mode 100644 index 5e93349..0000000 --- a/testData/inspections/constructorInspectionTest/nullaryConstructor/expected.xml +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<problems> -</problems>
\ No newline at end of file diff --git a/testData/inspections/constructorInspectionTest/nullaryConstructor/src/test.java b/testData/inspections/constructorInspectionTest/nullaryConstructor/src/test.java deleted file mode 100644 index 598fe2f..0000000 --- a/testData/inspections/constructorInspectionTest/nullaryConstructor/src/test.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.example.app; - -import com.google.api.server.spi.config.Api; - -@Api -public class Foo { - public Foo () {} -}
\ No newline at end of file diff --git a/testData/inspections/constructorInspectionTest/privateConstructor/expected.xml b/testData/inspections/constructorInspectionTest/privateConstructor/expected.xml deleted file mode 100644 index b1f7216..0000000 --- a/testData/inspections/constructorInspectionTest/privateConstructor/expected.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<problems> - <problem> - <file>test.java</file> - <line>7</line> - <description>Each class that is within an API must have a public nullary constructor.</description> - </problem> -</problems>
\ No newline at end of file |