Skip to content

Commit 6d55852

Browse files
update github urls from "master" to "main" (exercism#2141)
1 parent d6fe697 commit 6d55852

12 files changed

Lines changed: 85 additions & 28 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99

1010
Reviewer Resources:
1111

12-
[Track Policies](https://github.com/exercism/java/blob/master/POLICIES.md#event-checklist)
12+
[Track Policies](https://github.com/exercism/java/blob/main/POLICIES.md#event-checklist)

CONTRIBUTING.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ For general guidelines about contributing to Exercism see the [Exercism contribu
2727

2828
Hi! Thanks for contributing to the Exercism Java track!
2929

30-
Before opening your pull request, please review the [track policies](https://github.com/exercism/java/blob/master/POLICIES.md) and make sure your changes comply with them all.
30+
Before opening your pull request, please review the [track policies](https://github.com/exercism/java/blob/main/POLICIES.md) and make sure your changes comply with them all.
3131
This helps us focus our review time on the more important aspects of your contributions.
3232

3333
Also please only address one issue per pull request and reference the issue in your pull request. This makes it easier for us to review it, and it means that if we request changes to the fix for one issue, it won't prevent to a fix for another issue being merged.
@@ -48,7 +48,7 @@ To submit a fix for an existing exercise or port an exercise to Java with the le
4848
(see [exercism.io: Installing Java](https://exercism.org/docs/tracks/java/installation))
4949
- **Setup a branch on a fork of [exercism/java](https://github.com/exercism/java) on your computer.**
5050

51-
See [GitHub Help: Forking](https://help.github.com/articles/fork-a-repo/). Use those instructions (in conjunction with the [Git Basics doc](https://github.com/exercism/docs/blob/master/contributing/git-basics.md)) to:
51+
See [GitHub Help: Forking](https://help.github.com/articles/fork-a-repo/). Use those instructions (in conjunction with the [Contributing via GitHub](https://github.com/exercism/docs/tree/main/building/github#contributing-via-github)) to:
5252
* "fork" a repository on GitHub;
5353
- install `git`;
5454
- "clone" a copy of your fork;
@@ -164,7 +164,7 @@ The easiest way to achieve this is simply use the `bin/journey-test.sh` script.
164164
The easiest way to add a new exercise to the Java track is to port an exercise from another track.
165165
That means that you take an exercise that has already been implemented in another language and you implement it in this track.
166166

167-
To add a completely new exercise you need to open a pull request to the [problem specifications repository](https://github.com/exercism/problem-specifications/tree/master/exercises).
167+
To add a completely new exercise you need to open a pull request to the [problem specifications repository](https://github.com/exercism/problem-specifications/tree/main/exercises).
168168
Any completely new exercise needs to be added and accepted there before it can be added to the Java track.
169169

170170
There is a [general Exercism guide for porting an exercise to a new language](https://github.com/exercism/docs/blob/master/you-can-help/implement-an-exercise-from-specification.md).
@@ -186,7 +186,7 @@ This list is in alphabetical order so please add your exercise so that it mainta
186186

187187
* Please add an exercise submodule for your exercise.
188188
See [The Problem Submodules](#the-problem-submodules) section for what needs to be in this.
189-
See the [POLICIES doc](https://github.com/exercism/java/blob/master/POLICIES.md#starter-implementations) for an explanation of when you need to add a starter implementation.
189+
See the [POLICIES doc](https://github.com/exercism/java/blob/main/POLICIES.md#starter-implementations) for an explanation of when you need to add a starter implementation.
190190
The `build.gradle` file can just be copied from any other exercise submodule.
191191
The `README.md` file can be generated using [configlet](https://github.com/exercism/configlet/releases).
192192
You can do this by:
@@ -203,16 +203,16 @@ If there is canonical data for your exercise then you should follow this when ma
203203
We aim to follow the canonical data as closely as possible in our tests to ensure thorough test coverage.
204204
If there is canonical data available you also need to create a file at `exercises/exercise-slug/.meta/version` specifying the canonical data version you have implemented (e.g. `1.0.0`).
205205
The canonical data version can be found at the top of the canonical data file for that exercise.
206-
See other exercises, e.g. [acronym](https://github.com/exercism/java/tree/master/exercises/acronym/.meta), for an example `version` file.
206+
See other exercises, e.g. [acronym](https://github.com/exercism/java/tree/main/exercises/practice/acronym/.meta), for an example `version` file.
207207

208-
* Make sure you've followed the [track policies](https://github.com/exercism/java/blob/master/POLICIES.md), especially the ones for exercise added/updated.
208+
* Make sure you've followed the [track policies](https://github.com/exercism/java/blob/main/POLICIES.md), especially the ones for exercise added/updated.
209209

210210
Hopefully that should be enough information to help you port an exercise to the Java track.
211211
Feel free to open an issue or post in the [Gitter exercism/java room](https://gitter.im/exercism/java) if you have any questions and we'll try and answer as soon as we can.
212212

213213
## Updating the READMEs
214214

215-
The `README.md` files are generated from the exercise descriptions in [problem specifications](https://github.com/exercism/problem-specifications/tree/master/exercises).
215+
The `README.md` files are generated from the exercise descriptions in [problem specifications](https://github.com/exercism/problem-specifications/tree/main/exercises).
216216
They need to be regenerated regularly so that any changes to the descriptions in problem specifications propagate to our READMEs.
217217
This can be done using [configlet](https://github.com/exercism/configlet/releases):
218218

@@ -224,14 +224,14 @@ This can be done using [configlet](https://github.com/exercism/configlet/release
224224

225225
## Checking tests are up to date
226226

227-
The tests for each exercise should follow the canonical data in [problem specifications](https://github.com/exercism/problem-specifications/tree/master/exercises) as closely as possible.
227+
The tests for each exercise should follow the canonical data in [problem specifications](https://github.com/exercism/problem-specifications/tree/main/exercises) as closely as possible.
228228
The canonical data can change quite regularly, in which case the [canonical data version](https://github.com/exercism/problem-specifications#test-data-versioning) for that exercise will be updated.
229229

230-
We keep track of which version of the canonical data each exercise implements in a version file, for example: https://github.com/exercism/java/blob/master/exercises/two-fer/.meta/version.
230+
We keep track of which version of the canonical data each exercise implements in a version file, for example: https://github.com/exercism/java/blob/main/exercises/practice/two-fer/.meta/version.
231231
Not all exercises have canonical data in problem specifications.
232232
For those that don't we don't add a version file.
233233

234-
We have [a script](https://github.com/exercism/java/blob/master/scripts/canonical_data_check.sh) which can check if these version are up to date with the ones in problem specification.
234+
We have [a script](https://github.com/exercism/java/blob/main/scripts/canonical_data_check.sh) which can check if these version are up to date with the ones in problem specification.
235235
This script can be used to check if any version files, tests and reference implementations need updating.
236236

237237
To run this script:
@@ -242,7 +242,7 @@ To run this script:
242242

243243
## Checking tests are up to date and submit new issues
244244

245-
There is [a script which allows you to submit new issues](https://github.com/exercism/java/blob/master/scripts/create_issues_versionchange_canonical.sh) to this repo with generic title, description and labels if a change in version was detected.
245+
There is [a script which allows you to submit new issues](https://github.com/exercism/java/blob/main/scripts/create_issues_versionchange_canonical.sh) to this repo with generic title, description and labels if a change in version was detected.
246246

247247
Example generic new issue:
248248
<img width="1005" alt="image" src="https://user-images.githubusercontent.com/6614867/57221803-bf1a6600-7000-11e9-93cf-b930ef24ce97.png">
@@ -271,7 +271,7 @@ To run this script:
271271

272272
## Checking exercises are implemented and submit new issues
273273

274-
There is [a script](https://github.com/exercism/java/blob/master/scripts/create_issues_new_exercise.sh) which allows you to easily check if there are any exercism exercises which haven't been implemented in the Java track, and create issues for those exercises if there are any.
274+
There is [a script](https://github.com/exercism/java/blob/main/scripts/create_issues_new_exercise.sh) which allows you to easily check if there are any exercism exercises which haven't been implemented in the Java track, and create issues for those exercises if there are any.
275275

276276
Before you may submit a new issue, the script
277277
1. Checks whether the exercise exists in the Java track (compared to exercism/problem-specifications)

POLICIES.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ References: [[1](https://github.com/exercism/java/issues/177#issuecomment-261291
3636
> - Exercises of difficulty 4 or lower: provide stubs for all required constructors and methods. This means that you need to provide stubs for those constructors or methods that are necessary to pass all tests. E.g. stubs for private methods may be skipped.
3737
Stubs should include the following body:
3838
`throw new UnsupportedOperationException("Delete this statement and write your own implementation.");`
39-
> - Exercises of difficulty 5 or higher: copy the StubTemplate.java file (provided [here](https://github.com/exercism/java/tree/master/_template/src/main/java)) and rename it to fit the exercise. For example, for the exercise linked-list the file could be named LinkedList.java. Then either (1) add hints to the hints.md file (which gets merged into the README.md for the exercise) or (2) provide stubs as above for exercises that demand complicated method signatures.
39+
> - Exercises of difficulty 5 or higher: copy the StubTemplate.java file (provided [here](https://github.com/exercism/java/tree/main/_template/src/main/java)) and rename it to fit the exercise. For example, for the exercise linked-list the file could be named LinkedList.java. Then either (1) add hints to the hints.md file (which gets merged into the README.md for the exercise) or (2) provide stubs as above for exercises that demand complicated method signatures.
4040
4141
References: [[1](https://github.com/exercism/java/issues/178)], [[2](https://github.com/exercism/java/pull/683#discussion_r125506930)], [[3](https://github.com/exercism/java/issues/977)], [[4](https://github.com/exercism/java/issues/1721)]
4242

@@ -103,7 +103,7 @@ References: [[1](https://github.com/exercism/java/issues/395#issue-215734887)]
103103

104104
> If you're testing a class called `SomeClassName` then your test class should be called `SomeClassNameTest`.
105105
106-
> The exception to this is if the tests are split into several test classes where each test class tests different functionality. In that case each class should be named `SomeClassNameFunctionalityTest` where `Functionality` is the name of the functionality to be tested in that class. See the [clock exercise](https://github.com/exercism/java/tree/master/exercises/clock) as an example.
106+
> The exception to this is if the tests are split into several test classes where each test class tests different functionality. In that case each class should be named `SomeClassNameFunctionalityTest` where `Functionality` is the name of the functionality to be tested in that class. See the [clock exercise](https://github.com/exercism/java/tree/main/exercises/practice/clock) as an example.
107107
108108
References: [[1](https://github.com/exercism/java/issues/697)]
109109

@@ -115,7 +115,7 @@ References: [[1](https://github.com/exercism/java/issues/697)]
115115
116116
> Therefore a hints.md file should be added to the .meta directory for every exercise with difficulty 5.
117117
> This file should explain what they need to do when there is no starter implementation.
118-
> The files should all be the same so you can copy it from any other exercise with difficulty 5, e.g. [flatten-array](https://github.com/exercism/java/tree/master/exercises/flatten-array/.meta/hints.md).
118+
> The files should all be the same so you can copy it from any other exercise with difficulty 5, e.g. [flatten-array](https://github.com/exercism/java/tree/main/exercises/pratice/flatten-array/.meta/hints.md).
119119
120120
> We add the file to every exercise with difficulty 5 because the structure of the track means that we don't know which exercise will be the first one without starter implementation that a user will be faced with.
121121
@@ -131,7 +131,7 @@ References: [[1](https://github.com/exercism/java/issues/1389)]
131131

132132
### Avoid returning null
133133

134-
> The [canonical data](https://github.com/exercism/problem-specifications/tree/master/exercises) for each exercise intentionally doesn't deal with error handling.
134+
> The [canonical data](https://github.com/exercism/problem-specifications/tree/main/exercises) for each exercise intentionally doesn't deal with error handling.
135135
> When an error has occured or a method can't return anything, the canonical data will just mark that as `"expected": null`.
136136
> This is because error handling varies from language to language, so the canonical data is leaving it up to each language track to decide how to deal with those situations.
137137
> It doesn't mean that the method needs to return `null`.
@@ -141,11 +141,11 @@ References: [[1](https://github.com/exercism/java/issues/1389)]
141141
142142
> It's considered best practice to deal with errors and unexpected circumstances by throwing exceptions.
143143
> If you throw an exception then you force the user to deal with the problem.
144-
> You can either define your own exception (see [the triangle exercise](https://github.com/exercism/java/blob/master/exercises/triangle/.meta/src/reference/java/TriangleException.java) for an example) or use a predefined one (see [the collatz-conjecture exercise](https://github.com/exercism/java/blob/master/exercises/collatz-conjecture/src/test/java/CollatzCalculatorTest.java) for an example).
144+
> You can either define your own exception (see [the triangle exercise](https://github.com/exercism/java/blob/main/exercises/practice/triangle/.meta/src/reference/java/TriangleException.java) for an example) or use a predefined one (see [the collatz-conjecture exercise](https://github.com/exercism/java/blob/main/exercises/practice/collatz-conjecture/src/test/java/CollatzCalculatorTest.java) for an example).
145145
146146
> Another option is to use [Optionals](https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html).
147147
> This can be more suitable if the case you want to deal with isn't an exceptional occurence, but rather an expected scenario, e.g. a search method not finding what it was searching for.
148-
> See [the word-search exercise](https://github.com/exercism/java/blob/master/exercises/word-search/src/test/java/WordSearcherTest.java) for an example where `Optional` is used.
148+
> See [the word-search exercise](https://github.com/exercism/java/blob/main/exercises/practice/word-search/src/test/java/WordSearcherTest.java) for an example where `Optional` is used.
149149
150150
References: [[1](https://www.codebyamir.com/blog/stop-returning-null-in-java)]
151151

@@ -159,7 +159,7 @@ References: [[1](https://www.codebyamir.com/blog/stop-returning-null-in-java)]
159159
> Furthermore, you can make assertions on the state of a domain object after the exception has been thrown.
160160
> To be consistent, please use `assertThrows` whenever you expect an exception to be thrown.
161161
162-
> See [the triangle tests](https://github.com/exercism/java/blob/master/exercises/triangle/src/test/java/TriangleTest.java) for an example of where `assertThrows` is used.
162+
> See [the triangle tests](https://github.com/exercism/java/blob/main/exercises/practice/triangle/src/test/java/TriangleTest.java) for an example of where `assertThrows` is used.
163163
164164
References: [[1](https://github.com/junit-team/junit4/wiki/Exception-testing)]
165165

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ Source for Exercism Exercises in Java.
88

99
For general information about how to contribute to Exercism, please refer to the [Contributing Guide](https://exercism.org/contributing).
1010

11-
For information on contributing to this track, refer to the [CONTRIBUTING.md](https://github.com/exercism/java/blob/master/CONTRIBUTING.md) file.
11+
For information on contributing to this track, refer to the [CONTRIBUTING.md](https://github.com/exercism/java/blob/main/CONTRIBUTING.md) file.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
Since this exercise has difficulty 5 it doesn't come with any starter implementation.
2+
This is so that you get to practice creating classes and methods which is an important part of programming in Java.
3+
It does mean that when you first try to run the tests, they won't compile.
4+
They will give you an error similar to:
5+
```
6+
path-to-exercism-dir\exercism\java\name-of-exercise\src\test\java\ExerciseClassNameTest.java:14: error: cannot find symbol
7+
ExerciseClassName exerciseClassName = new ExerciseClassName();
8+
^
9+
symbol: class ExerciseClassName
10+
location: class ExerciseClassNameTest
11+
```
12+
This error occurs because the test refers to a class that hasn't been created yet (`ExerciseClassName`).
13+
To resolve the error you need to add a file matching the class name in the error to the `src/main/java` directory.
14+
For example, for the error above you would add a file called `ExerciseClassName.java`.
15+
16+
When you try to run the tests again you will get slightly different errors.
17+
You might get an error similar to:
18+
```
19+
constructor ExerciseClassName in class ExerciseClassName cannot be applied to given types;
20+
ExerciseClassName exerciseClassName = new ExerciseClassName("some argument");
21+
^
22+
required: no arguments
23+
found: String
24+
reason: actual and formal argument lists differ in length
25+
```
26+
This error means that you need to add a [constructor](https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html) to your new class.
27+
If you don't add a constructor, Java will add a default one for you.
28+
This default constructor takes no arguments.
29+
So if the tests expect your class to have a constructor which takes arguments, then you need to create this constructor yourself.
30+
In the example above you could add:
31+
```
32+
ExerciseClassName(String input) {
33+
}
34+
```
35+
That should make the error go away, though you might need to add some more code to your constructor to make the test pass!
36+
37+
You might also get an error similar to:
38+
```
39+
error: cannot find symbol
40+
assertEquals(expectedOutput, exerciseClassName.someMethod());
41+
^
42+
symbol: method someMethod()
43+
location: variable exerciseClassName of type ExerciseClassName
44+
```
45+
This error means that you need to add a method called `someMethod` to your new class.
46+
In the example above you would add:
47+
```
48+
String someMethod() {
49+
return "";
50+
}
51+
```
52+
Make sure the return type matches what the test is expecting.
53+
You can find out which return type it should have by looking at the type of object it's being compared to in the tests.
54+
Or you could set your method to return some random type (e.g. `void`), and run the tests again.
55+
The new error should tell you which type it's expecting.
56+
57+
After having resolved these errors you should be ready to start making the tests pass!

exercises/practice/hello-world/.docs/instructions.append.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,4 @@ The entire of Exercism is Open Source and is a labor of love for over
138138

139139
A starting point to jumping in can be found here:
140140

141-
https://github.com/exercism/docs/tree/master/contributing-to-language-tracks
141+
https://github.com/exercism/docs/tree/main/building

reference/exercise-concepts/gigasecond.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Gigasecond
22

3-
[Example implementation](https://github.com/exercism/java/blob/master/exercises/gigasecond/.meta/src/reference/java/Gigasecond.java)
3+
[Example implementation](https://github.com/exercism/java/blob/main/exercises/practice/gigasecond/.meta/src/reference/java/Gigasecond.java)
44

55
## General
66

reference/exercise-concepts/leap.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#Leap
44

5-
[Example implementation](https://github.com/exercism/java/blob/master/exercises/leap/.meta/src/reference/java/Leap.java)
5+
[Example implementation](https://github.com/exercism/java/blob/main/exercises/practice/leap/.meta/src/reference/java/Leap.java)
66

77
## General
88

0 commit comments

Comments
 (0)