Skip to content

Commit 1eb2909

Browse files
authored
Remove unneeded reserved words (#246)
* Remove unnecessary reserved words * Regenerate
1 parent be04eab commit 1eb2909

7 files changed

Lines changed: 43 additions & 44 deletions

File tree

src/JavaCodeGenerator.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,7 @@ private static Service ParseService(AutoRestCodeModel codeModel, JavaSettings se
333333
"protected","public", "return", "short", "static",
334334
"strictfp", "super", "switch", "synchronized","this",
335335
"throw", "throws", "transient","true", "try",
336-
"void", "volatile", "while", "date", "datetime",
337-
"period", "stream", "string", "object", "header"
336+
"void", "volatile", "while"
338337
});
339338

340339
if (!settings.IsAzureOrFluent)

test/vanilla/src/main/java/fixtures/bodyarray/models/Product.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ public final class Product {
2323
private Integer integer;
2424

2525
/**
26-
* The stringProperty property.
26+
* The string property.
2727
*/
2828
@JsonProperty(value = "string")
29-
private String stringProperty;
29+
private String string;
3030

3131
/**
3232
* Get the integer value.
@@ -49,22 +49,22 @@ public Product withInteger(Integer integer) {
4949
}
5050

5151
/**
52-
* Get the stringProperty value.
52+
* Get the string value.
5353
*
54-
* @return the stringProperty value.
54+
* @return the string value.
5555
*/
56-
public String stringProperty() {
57-
return this.stringProperty;
56+
public String string() {
57+
return this.string;
5858
}
5959

6060
/**
61-
* Set the stringProperty value.
61+
* Set the string value.
6262
*
63-
* @param stringProperty the stringProperty value to set.
63+
* @param string the string value to set.
6464
* @return the Product object itself.
6565
*/
66-
public Product withStringProperty(String stringProperty) {
67-
this.stringProperty = stringProperty;
66+
public Product withString(String string) {
67+
this.string = string;
6868
return this;
6969
}
7070
}

test/vanilla/src/main/java/fixtures/bodydictionary/models/Widget.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ public final class Widget {
2323
private Integer integer;
2424

2525
/**
26-
* The stringProperty property.
26+
* The string property.
2727
*/
2828
@JsonProperty(value = "string")
29-
private String stringProperty;
29+
private String string;
3030

3131
/**
3232
* Get the integer value.
@@ -49,22 +49,22 @@ public Widget withInteger(Integer integer) {
4949
}
5050

5151
/**
52-
* Get the stringProperty value.
52+
* Get the string value.
5353
*
54-
* @return the stringProperty value.
54+
* @return the string value.
5555
*/
56-
public String stringProperty() {
57-
return this.stringProperty;
56+
public String string() {
57+
return this.string;
5858
}
5959

6060
/**
61-
* Set the stringProperty value.
61+
* Set the string value.
6262
*
63-
* @param stringProperty the stringProperty value to set.
63+
* @param string the string value to set.
6464
* @return the Widget object itself.
6565
*/
66-
public Widget withStringProperty(String stringProperty) {
67-
this.stringProperty = stringProperty;
66+
public Widget withString(String string) {
67+
this.string = string;
6868
return this;
6969
}
7070
}

test/vanilla/src/test/java/fixtures/bodyarray/ArrayTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -439,31 +439,31 @@ public void getComplexItemNull() {
439439
public void getComplexItemEmpty() {
440440
List<Product> result = client.arrays().getComplexItemEmpty();
441441
assertEquals(3, result.size());
442-
assertNull(result.get(1).stringProperty());
442+
assertNull(result.get(1).string());
443443
}
444444

445445
@Test
446446
public void getComplexValid() {
447447
List<Product> result = client.arrays().getComplexValid();
448448
assertEquals(3, result.size());
449449
assertEquals(5, result.get(2).integer().intValue());
450-
assertEquals("6", result.get(2).stringProperty());
450+
assertEquals("6", result.get(2).string());
451451
}
452452

453453
@Test
454454
public void putComplexValid() {
455455
List<Product> body = new ArrayList<>();
456456
Product p1 = new Product();
457457
p1.withInteger(1);
458-
p1.withStringProperty("2");
458+
p1.withString("2");
459459
body.add(p1);
460460
Product p2 = new Product();
461461
p2.withInteger(3);
462-
p2.withStringProperty("4");
462+
p2.withString("4");
463463
body.add(p2);
464464
Product p3 = new Product();
465465
p3.withInteger(5);
466-
p3.withStringProperty("6");
466+
p3.withString("6");
467467
body.add(p3);
468468
client.arrays().putComplexValid(body);
469469
}

test/vanilla/src/test/java/fixtures/bodydictionary/DictionaryTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -452,31 +452,31 @@ public void getComplexItemEmpty() {
452452
Map<String, Widget> result = client.dictionarys().getComplexItemEmpty();
453453
assertEquals(3, result.size());
454454
assertNull(result.get("1").integer());
455-
assertNull(result.get("1").stringProperty());
455+
assertNull(result.get("1").string());
456456
}
457457

458458
@Test
459459
public void getComplexValid() {
460460
Map<String, Widget> result = client.dictionarys().getComplexValid();
461461
assertEquals(3, result.size());
462462
assertEquals(1, result.get("0").integer().intValue());
463-
assertEquals("4", result.get("1").stringProperty());
463+
assertEquals("4", result.get("1").string());
464464
}
465465

466466
@Test
467467
public void putComplexValid() {
468468
Map<String, Widget> body = new HashMap<>();
469469
Widget w1 = new Widget();
470470
w1.withInteger(1);
471-
w1.withStringProperty("2");
471+
w1.withString("2");
472472
body.put("0", w1);
473473
Widget w2 = new Widget();
474474
w2.withInteger(3);
475-
w2.withStringProperty("4");
475+
w2.withString("4");
476476
body.put("1", w2);
477477
Widget w3 = new Widget();
478478
w3.withInteger(5);
479-
w3.withStringProperty("6");
479+
w3.withString("6");
480480
body.put("2", w3);
481481
client.dictionarys().putComplexValid(body);
482482
}

test/xml/src/main/java/fixtures/xml/models/Slideshow.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ public final class Slideshow {
2828
private String title;
2929

3030
/**
31-
* The dateProperty property.
31+
* The date property.
3232
*/
3333
@JacksonXmlProperty(localName = "date", isAttribute = true)
34-
private String dateProperty;
34+
private String date;
3535

3636
/**
3737
* The author property.
@@ -66,22 +66,22 @@ public Slideshow withTitle(String title) {
6666
}
6767

6868
/**
69-
* Get the dateProperty value.
69+
* Get the date value.
7070
*
71-
* @return the dateProperty value.
71+
* @return the date value.
7272
*/
73-
public String dateProperty() {
74-
return this.dateProperty;
73+
public String date() {
74+
return this.date;
7575
}
7676

7777
/**
78-
* Set the dateProperty value.
78+
* Set the date value.
7979
*
80-
* @param dateProperty the dateProperty value to set.
80+
* @param date the date value to set.
8181
* @return the Slideshow object itself.
8282
*/
83-
public Slideshow withDateProperty(String dateProperty) {
84-
this.dateProperty = dateProperty;
83+
public Slideshow withDate(String date) {
84+
this.date = date;
8585
return this;
8686
}
8787

test/xml/src/test/java/fixtures/xml/XmlsTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void getSimpleDocument() {
3131
Slideshow slideshow = client.xmls().getSimple();
3232
assertNotNull(slideshow);
3333
assertEquals("Yours Truly", slideshow.author());
34-
assertEquals("Date of publication", slideshow.dateProperty());
34+
assertEquals("Date of publication", slideshow.date());
3535
assertEquals("Sample Slide Show", slideshow.title());
3636

3737
assertNotNull(slideshow.slides());
@@ -56,7 +56,7 @@ public void getEmptyList() {
5656
assertNotNull(slideshow.slides());
5757
assertEquals(null, slideshow.title());
5858
assertEquals(null, slideshow.author());
59-
assertEquals(null, slideshow.dateProperty());
59+
assertEquals(null, slideshow.date());
6060
assertEquals(0, slideshow.slides().size());
6161
}
6262

0 commit comments

Comments
 (0)