Go to CS2103/T main site
  • Dashboards home
  • Participation dashboard
  • Forum dashboard
  • iP progress
  • iP comments
  • iP Code
  • tP progress
  • tP comments
  • tP Code
  • Forum activities dashboard

    This dashboard is updated weekly.

    [This page was last updated on Apr 02 2021] [ indicates those watching the forum (kudos 👍)]

    Hello,

    For the user guide, I understand there were mentions of including only relevant parts of the application in a screenshot (so that they need not be frequently changed with updates). However, on the other hand, the tradeoff is that it is up to the user to identify which part of the application the screenshot is referring to.

    That said, if the team feels that the UI is unlikely to receive frequent updates once it has been finalised, would it not be neater to display the entire application to the user (perhaps with annotations) so that at one glance they immediately know which part of the application to look out for? I imagine this saves time for the user and also eliminates room for confusion.

    This brings me on to the following point:

    Screenshot 2021-03-26 at 4 22 49 PM

    If a screenshot of the entire application is used, it will undoubtedly appear repetitive in the sense that there will be the same layout present in every screenshot. However, I am not sure if this would necessarily impair a user's experience, given that unfamiliar users might appreciate having the full picture. After all, the issue seems more to be the ease of maintenance. May I thus clarify if using full screenshots showing the different states/commands of an application will automatically count as a bug?

    Thank you in advance!

    Hello!

    Our application has unicode characters which shows up fine on mac/windows but require the additional installation below to show up on ubuntu:

    apt-get install ttf-ancient-fonts

    May I clarify if it is alright to include this as an instruction specific to ubuntu users?

    Thank You!

    Hello! I would like to clarify on the names for our milestones.

    This was what was advised in week 7 of the project:

    Screenshot 2021-03-03 at 7 38 52 PM

    This was what was advised in week 8 of the project:

    Screenshot 2021-03-03 at 7 26 33 PM

    I am not sure if I have misunderstood any of the above instructions but I am currently confused as to how the milestones should be named for them to be tracked correctly. Specifically, if a weekly iteration approach is taken, should the milestones be named mid-v1.2 and v1.2? Or should they be named v1.2 and v1.2b?

    Thank you in advance!

    Library

    Apache HttpClient

    Purpose

    Make API calls as part of app functionality.

    License

    Apache License 2.0

    Hello!

    Just a small clarification to make. Given that the first word of the commit message has to be capitalised, would both of the following be acceptable for commit messages?

    
    Docs: update readme to include image
    
    Docs: Update readme to include image
    
    

    That is, for the word immediately after the type of commit, do we need to capitalise it as well?

    Thank You!

    Hello!

    Thought to share a quick guide for the use of checkstyle since there has been quite a number of issues surrounding it. Hopefully this also serves as a sort of checklist in case some steps might have been missed out in setting up checkstyle! 😃

    Disclaimer: You might want to make a copy of your current project first. These steps worked for me though I have only tested them on MacOS and while I do not believe they will cause issues, it's better to err on the side of caution :3 Additionally, This quick guide provides the key steps to setting up checkstyle but the full tutorial can be found here. Steps are below!

    1. Head over to the root of your project and create the directories as follow:
    
    ./config/checkstyle/
    
    
    1. Within the newly created ./config/checkstyle/ folder, place both checkstyle.xml and suppressions.xml files which can be retrieved here.

    2. Within your build.gradle file, ensure checkstyle is included as shown below:

    
    plugins {
    
        // previously added plugins
    
        id 'checkstyle'
    
    }
    
    
    
    checkstyle {
    
        toolVersion = '8.29'
    
    }
    
    
    1. Reload your project and the following command should work:
    
    gradlew checkstyleMain checkstyleTest
    
    

    Extra:

    The current checkstyle.xml file does not check for capitalisation of constant names for private attributes even though the coding standard requires that to be the case. This can be updated in line 107 of checkstyle.xml by changing the boolean of the property as shown below:

    Before

    
    <property name="applyToPrivate" value="false"/>
    
    

    After

    
    <property name="applyToPrivate" value="true"/>
    
    

    Hope this helps 😄

    Hello!

    I would like to highlight the following discrepancies between the checkstyle file and java coding standard:

    1. Screaming snake case not enforced for private attributes in checkstyle file.

    2. Javadocs header comments not enforced for getters, setters and constructors.

    I am under the impression the java coding standard takes precedence over the checkstyle file so it might be best to manually check for the above until the discrepancies are sorted out 😄

    Hello!

    I struggled a bit creating the JAR file with third-party libraries for tag A-Jar as a fat JAR file is needed to solve dependency issues as highlighted in this guide, so I thought to just share some steps that might help anyone else using third-party libraries as well.

    Disclaimer: You might want to make a copy of your current project first. These steps worked for me though I have only tested them on MacOS and while I do not believe they will cause issues, it's better to err on the side of caution :3 Steps are below!

    1. The guide recommends the use of gradle for creating a fat JAR file (in fact, peeking into week 4 project would reveal the need to eventually follow scenario 2 of the guide). Under all of our forked repos, there (thankfully) already exist a branch called add-gradle-support. Fetch the branch and track it:
    
    git fetch origin add-gradle-support  
    
    git checkout --track origin/add-gradle-support
    
    
    1. Check that the add-gradle-support branch exist then switch over to your master and merge the new branch in:
    
    git branch
    
    git checkout master
    
    git merge add-gradle-support
    
    
    1. If you do not see a build.gradle file now appearing in the root of your project, close and reopen your project then open up the build.gradle file. Under dependencies section in the file, add your third-party library. For example, using the json-simple library, the dependencies section would look as such (notice the additional first line):
    
    dependencies {
    
        implementation 'com.googlecode.json-simple:json-simple:1.1.1'
    
        testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.0'
    
        testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.5.0'
    
    }
    
    
    1. Next, under the application section of the file, edit mainClassName to match that of your main class (Duke if you have been using that name all the time). If you did the A-Packages tag, this will need to match your package name as well. For example, if your java files sit under the package com.example.app with the main class Duke, your mainClassName in the build.gradle file will look as such:
    
    application {
    
        mainClassName = "com.example.app.Duke"
    
    }
    
    
    1. Finally, run the following command in the root of your project on the terminal:
    
    ./gradlew shadowJar
    
    
    1. From the root of your project directory, you will find the new JAR file within the ./build/libs folder which you can then run with the java -jar command.

    I hope this serves as a good reference but please raise up any mistakes I may have made! Thanks 😄

    Library

    json-simple

    Purpose

    Use json file for storing/retrieving task information.

    License

    Apache License 2.0

    Hello,

    I was working on increment Level-7 and Level-8 in their respective branches. After finishing both of them, I forced git to create a merge commit using the --no-ff flag as shown below:

    
    git merge --no-ff branch-Level-7
    
    

    This worked for merging Level-7 with my master but merging Level-8 raised up merge conflicts with the following message:

    
    java_projects/ip$ git merge --no-ff branch-Level-8
    
    Auto-merging src/main/java/Command.java
    
    CONFLICT (content): Merge conflict in src/main/java/Command.java
    
    Automatic merge failed; fix conflicts and then commit the result.
    
    

    I thus went ahead to resolve the conflicts, add and commit the files within the master branch (kindly advice if this is the correct branch to resolve conflicts on). After committing the modified files and running the merge command again, I was greeted instead with an Already up to date message. Pushing the commits however, did not create a commit message despite me specifying the --no-ff flag earlier. Is this expected behaviour?

    Edit: Added screenshot of the commit history on my master branch in case the explanation above was not clear enough :3

    Screenshot 2021-01-22 at 10 04 09 PM

    Thank you!

    Hello!

    For git commit messages, I have noticed an inconsistency between an example given in the week 2 topics and the SE education guide, the latter which I just learned about. For clarity sake, the styles shown in the above 2 links are as below.

    Example in week 2 topics:

    Screenshot 2021-01-19 at 11 18 11 AM

    Guidelines in SE education guide:

    Screenshot 2021-01-19 at 11 18 19 AM

    My past commits have all been done following the conventional commits, which is more inline with the first example above (the notable difference is the capitalisation of the first word in the commit message). Moving forward, may I know which modes of commit styles are allowed and should the case be that the first word must be capitalised, does that mean I have to update all past commit messages? ;-;

    Thank you!

    Hello,

    I would like to clarify if we are required to revisit old tags and fix issues that we might have overlooked. In particular, running runtest.sh for A-TextUiTesting threw the following error for me despite passing the test:

    Screenshot 2021-01-18 at 2 43 47 AM

    The error is thrown because I had used a while true loop instead of checking for nextLine in the scanner to take inputs thus far. As I am unaware of how the automated grading scripts work for the previous levels (or rather what they look out for), I am concerned that the previous levels might be affected by the while true loop implementation when ran against the scripts. At the same time, I have also realised that it is impossible to commit to those previous tags which means updating them individually would be quite a hassle.

    I would really appreciate advice on this, thank you!

    Hello,

    I would like to clarify if there is a need for us to concern ourselves with whether repeated task names are allowed/disallowed. Without checking for repeated task names, it would mean the following scenario is possible:

    repeated_task_names

    If repeated task names are allowed, then a follow-up question would be is there a need to distinguish them uniquely when tasks are marked as done (this affects implementation).

    Kindly advice, thank you!

    Understood, thank you very much!

    Hello! Just to add on to what @w2vgd said above, the reason for the version incompatibility is due to github deprecating their password authentication. For anyone facing a similar issue on SourceTree, this thread also contains relevant information. Hope you get your issue sorted out!

    Hey @zoeykobe! See if the accepted answer (and its comments) in this thread helps. It seems to describe an issue very similar to yours! 😃

    Thank you for the clarification!

    Hello!

    The split function in java allows a second parameter called limit, which is the threshold for the number of elements obtained in the result.

    For example:

    
    String str = "Hello there, nice to meet you!";
    
    String[] parsedStr = str.split(" ", 2);
    
    

    In the above example, parsedStr will contain these 2 elements:

    
    {"Hello", "there, nice to meet you!"}
    
    

    Hope this helps! 😃

    Oh right! Thanks a lot for pointing this out. I was under the impression from the documentation that it would only return the first two strings that are matched by the pattern, my bad.

    Still interested in finding a regex way though! Will close the issue later then.

    I edited the example for clarity to future viewers. Didn't realise the example wasn't obvious in highlighting that it returns the rest of the string, thanks too 😄

    Hello!

    Not familiar with WSL but are there any solutions you have tried and what are you getting when you type java instead of javac on the command prompt? Hopefully the extra information will help spur potential answers though lots of results online seem to be pointing this as a path issue :3

    Hello Prof @damithc!

    Thank you for the response. I am slightly confused by your second statement. The technique taught in the SE-edu guide seems to enforce capitalisation of the first word in the commit message whereas the convention does not. Wouldn't this mean they do not sit well with each other? In fact, the education guide and convention are both contradicting each other so if the former is always the same for every project, wouldn't it mean the latter is never followed? Sorry for the many questions, thank you again for answering!

    Edit: Do I have to update past commit messages to adhere to the SE-edu guidelines or is it alright to just do it for future commits? :3

    That clears it up a lot, appreciate it. Thank you very much prof @damithc! 😃

    Hello!

    Have you tried running each individual line within the .bat file directly on your command prompt to see if the error messages yield more information?

    I am not entirely familiar with windows but have you tried running the command as administrator? If you are able to do so, then there is likely a permission issue and you might want to check the ownership for the affected files/folders. Otherwise, this article contains quite a number of options that you might want to explore.

    If all else fails and it's convenient for you, it would be good to list some of the options you tried so that someone more competent can come along to help. Sorry I couldn't do much ;-;

    From what I can see in the screenshot, you are running the command from C:\WINDOWS\system32. The paths specified in both the runtest.sh and runtest.bat files however, use relative paths from the test-ui-test directory of the project (notice the presence of .. which refers to the parent directory of where you are executing your command). Try running the command inside the test-ui-test directory and see if it works 😃

    I think it was not explicitly said in the instructions to run the scripts within the test-ui-test directory. That said, .. does not actually refer to test-ui-test, rather, it refers to the parent directory of wherever you were running your command from. When you originally ran the command from C:\WINDOWS\system32, .. would have brought you up one directory to WINDOWS. When ran from the test-ui-test folder, ..\src\main\java\*.java first moves up one directory to iP (project folder), then it looks for src which it can find in the project folder, then main, java and finally all the java files inside the java folder.

    When you see relative paths specified, it is almost certain you need to run the script from a specific directory (otherwise it is likely you will not be able to find some of the files). At this point you might think why not just use absolute paths, but keeping paths relative does make the program more portable (it's plug and play most of the time). Both have their pros and cons, hope this clarifies 😄

    Also, am I right to say that we can skip doing enums and still count as a completed project?

    Prof Damith mentioned in a separate issue here that there are no penalties for optional and if-applicable increments 😃

    @colintkn To add on, you may also consider using the scanner method hasNextLine() in your loop condition. In that way, regardless of the input, your loop will only continue if it detects that there are subsequent inputs, thereby eliminating the NoSuchElementException you are getting.

    @galvinleow @w2vgd Thank you for the help! Just got a bit uncomfortable and worried when I didn't see a merge commit message despite forcing it in the command 😛

    Based on what Prof Damith said here, I think the tags are for us to measure our own progress. My own branches weren't error free when I pushed them but I tagged them anyways :3

    Just a suggestion but maybe can consolidate with the sourcetree version from @litone01 as well for easier reference, thanks 😄

    Hi @kangtinglee, JUnit comes with these 2 annotations:

    
    @BeforeEach
    
    @AfterEach
    
    

    As their names suggest, methods with these annotations are executed before and after each test and I believe that would be where your setup (and teardown) code goes. I am however interested to know if there are any other practices as well 😃

    I have yet to construct unit test for such fields and I do agree it seems quite meaningless xD However, should there be a situation where there is a need to ensure the description is correct, I would likely construct a test case as below within the DummyTest class:

    
    @Test
    
    void checkDescription_whenInputDescription_thenDescriptionMatch() {
    
        String expected = "This is a dummy class.";
    
        Dummy dummy = new Dummy();
    
        assertEquals(expected, dummy.DESCRIPTION);
    
    }
    
    

    Just want to extend the discussion a little bit: normally we would have a lot of such static final field declarations in our application, then managing the 'expectations' would be quite troublesome already. I guess there would be some place/some way for us to manage what would be expected for the (important) static fields easily (e.g. instead of peeking at individual classes), but I have no clue : |. Anyone knows anything about it?

    I agree it's going to be huge hassle with lots of static final field declarations. Off the top of my head, I imagine for larger applications with lots of static final field declarations of string types, these strings may be stored/read from inside a messages.yml or messages.json file of sorts (has the added benefit of easy configuration/changing messages without directly editing the file containing code). It might then be possible to construct a single test class pertaining to all these messages which should at least centralise the testing and makes things slightly more organised. What do you think?

    @gycc7253 You might need to check if the parent directory for your file actually exist before attempting to create it. For example, if you were creating a file as below, the data directory might not be present yet:

    
    File file = new File("./data/tasks.txt");
    
    

    In which case, you may need an extra line of code after that to create the data directory:

    
    file.getParentFile().mkdirs();
    
    

    Out of curiosity, I compiled the project with nothing marked as root and randomly marking a file as root. Turns out even though IntelliJ flagged out problems for the latter, compilation of the project still worked in all cases and the JAR file runs perfectly fine. I did notice that the editor has some useful labels (for example parameter names) that only appear when you have the Sources Root set correctly. Otherwise, just from this small tinkering around it does seem like setting the root is more of an enhancement.

    From the first line of the instruction, it says to create the folder [project_name]\src\test\java\. This would imply the java folder is supposed to be created manually which you have already done. I did not actually change anything inside the test.iml file although more on what the file is about is explained here.

    @rajobasu By external file do you mean other java files within the same package? I imagine static variables in these files would then be referred to through their class names so maybe something like Dummy.staticVariableHere (static methods would also be referenced similarly).

    @rajobasu Both JSON and YAML are file formats for storing data. You are right to say they will have to be loaded and these are usually done through third-party libraries which differ across programming languages. For JSON in java, we have the likes of Jackson and json-simple. These libraries provide means for us to load in the data from those files which we can then assign to static final variables. Hope that clarifies 😄

    Edit: Exception handling will need to be done for reading/writing from .json and .yml files but is handled within the code. The files themselves just hold the information. I am not actually sure this is the best way to do things but there is the benefit of consolidating messages within a file and modifying them without having to touch the codebase directly.

    @rajobasu That's a really great point. I have been theory-crafting up till this point and am honestly unsure of how file contents can be specifically loaded into static final variables. I did a quick google search and you are right about the approach with initialisation class/codes. As to why they would not feel ideal, could you share more? I imagine even if this doesn't work well for messages, would it still at least work well for a configuration file?

    Edit: I think it might be possible to group constants of a similar nature together instead of by class (for example messages pertaining to information). I am not sure what associated dangers there may be because any sensitive information should not be stored in plain text to begin with. Are there any dangers I am overlooking?

    There are surprisingly little resources explaining the contents of a .iml file, specifically for orderEntry. I just left it alone because I didn't think it was important xD

    If you need a third comparison, mine also looks flipped compared to @rajobasu.

    Sure thing @w2vgd!

    ip.iml (sitting at the root directory of the project):

    
    <?xml version="1.0" encoding="UTF-8"?>
    
    <module type="JAVA_MODULE" version="4">
    
      <component name="NewModuleRootManager" inherit-compiler-output="true">
    
        <exclude-output />
    
        <content url="file://$MODULE_DIR$">
    
          <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
    
        </content>
    
        <orderEntry type="inheritedJdk" />
    
        <orderEntry type="sourceFolder" forTests="false" />
    
        <orderEntry type="library" name="com.googlecode.json-simple:json-simple:1.1.1" level="project" />
    
      </component>
    
    </module>
    
    

    test.iml (sitting within the src/test folder):

    
    <?xml version="1.0" encoding="UTF-8"?>
    
    <module type="WEB_MODULE" version="4">
    
      <component name="NewModuleRootManager" inherit-compiler-output="true">
    
        <exclude-output />
    
        <content url="file://$MODULE_DIR$">
    
          <sourceFolder url="file://$MODULE_DIR$/java" isTestSource="true" />
    
        </content>
    
        <orderEntry type="inheritedJdk" />
    
        <orderEntry type="sourceFolder" forTests="false" />
    
        <orderEntry type="module-library" scope="TEST">
    
          <library name="JUnit5.4">
    
            <CLASSES>
    
              <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.4.2/junit-jupiter-5.4.2.jar!/" />
    
              <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.4.2/junit-jupiter-api-5.4.2.jar!/" />
    
              <root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.jar!/" />
    
              <root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.1.1/opentest4j-1.1.1.jar!/" />
    
              <root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.4.2/junit-platform-commons-1.4.2.jar!/" />
    
              <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.4.2/junit-jupiter-params-5.4.2.jar!/" />
    
              <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.4.2/junit-jupiter-engine-5.4.2.jar!/" />
    
              <root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.4.2/junit-platform-engine-1.4.2.jar!/" />
    
            </CLASSES>
    
            <JAVADOC />
    
            <SOURCES />
    
          </library>
    
        </orderEntry>
    
        <orderEntry type="module" module-name="ip" scope="TEST" />
    
        <orderEntry type="library" scope="TEST" name="com.googlecode.json-simple:json-simple:1.1.1" level="project" />
    
      </component>
    
    </module>
    
    

    I have extra lines from using json-simple but the general structure should be similar (hopefully) :3

    Ahhh... I think I am starting to get how the .iml files work (I hope 😅). Just throwing out a hypothesis but it seems the &gt;sourceFolder> tag specifies which modules the .iml file applies to. It should then technically be possible for a single .iml file to apply to multiple modules in a project (hence the multiple &gt;sourceFolder> tag in your original ip.iml). Should that be true, it might be that ip.iml was taking priority (for whatever reason) over your test.iml file, hence triggering the error you saw. I am guessing it would also work if you copy the contents for JUnit from the test.iml file into ip.iml file but since it's working now I guess it's good xD

    For a void method I think it depends on what the method itself achieves. I had a similar situation where my void methods were merely printing outputs and this guide here proved very helpful. In another scenario, it is possible that a void method alters a particular attribute of an object and in that case, I believe checking if the attribute was altered successfully would suffice. For these cases, the @BeforeEach and @AfterEach annotations would come in useful.

    Might be a similar issue to this. See if the solutions there help 😄

    I believe the system is unable to find the path specified because the folders containing your .txt file is not present. If you go to where your jar file is sitting and create the folders as such ./src/main/data/ and run your jar file again, does it work?

    Yup! If you created the folders manually and that solved your issue then you can look to implement the file creation in your code instead 😄

    Yikes, is it still the same error message and are you running java -jar within the same directory in both IntelliJ and on the shell? It might help to attach some screenshots or share the structure of your project currently as well 😃

    From the shell, can you check if there is a src folder in the same directory as where your Kelbot.jar is? If there is, check if there is a main folder within the src folder. Finally, check if there is a data folder within the main folder. If any of the three folders are not present, your code responsible for creating the folders is likely not working as intended.

    Did you annotate the test methods with @Test? If not, could you share the structure of your project? You might also want to compare your .iml files with those in this issue, hopefully it'll help 😄

    So I just double checked and I have a data folder created at ./out/artifacts/ip_jar/data for my case where I stored my data file in ./data/tasks.json. I believe your code will need to ensure that ./src/main/data is created at where your jar file is sitting. Give it a try and see if that works 😄

    Edit: Consider adapting and playing around with the following:

    
    File file = new File("./data/tasks.json");
    
    file.getParentFile().mkdirs();
    
    

    I changed my path to be relative, with java.nio.file.Paths.get("..","..", "data", "Kelbot.txt");, as I suspected that since my jar file is not in src, the original path is not working there, however i got an access denied...

    The use of double .. will bring you two directories up to the out folder but I am unsure how this will help with your case 😅 Since you are getting an access denied error, try running the cmd prompt as an administrator. If this works, you can check your folder/file permissions 😃

    I suggest working with a simple ./data/Kelbot.txt for now (which means a data folder at where your jar file is and the text file will be created within it). Access denied does sound like a separate problem which will require you to check read/write permissions but take it step by step and see if you are able to run the jar file as administrator from the cmd prompt first 😃

    When running the code directly in Intellij, the file is created with respect to the root directory of ip (./data/Kelbot.txt in this case would mean having a data folder in the same place as where your src folder is). When you build it as a jar and run it with java -jar instead, the file is now created with respect to the jar file. At least that's how I understand/have observed it (I hope I have not been rambling on wrongly ;-😉. But stick with ./ and see if it works out. If access denied still pops up, try running as administrator in cmd prompt and see if that helps too 😄

    Essentially yup! You have 2 different data/Kelbot.txt (one from directly in IntelliJ, one from running as jar). In fact you can move the jar file to elsewhere on your computer and the new data folder will take reference from wherever you moved it too.

    I am not sure if this is actually relevant to the error you are facing (although with your current structure, copy pasting the .iml files without modifications will likely fail). Nonetheless, if you are willing to do a minor restructure on your project, you can consider the following:

    1. Instead of marking the src folder as your Sources Root, mark the java folder within your main folder as your Sources Root (this does mean you need to change your package statements in your java files).

    2. Then, you may follow this guide which essentially brings you through replicating the folder structure under test folder to mirror that of the main folder (your test classes need to be created in a matching package). You would then end up with a structure similar to this:

    
    src
    
      - main
    
        - java (Sources Root)
    
          - duke
    
            - *.java 
    
      - test
    
        - java (Test Sources Root)
    
          - duke
    
            - *.java 
    
    

    It's a bit neater to see both main and test folders mirroring each other and the .iml file you referred to earlier should fit nicely with this structure as well. See if this actually helps with your issue, otherwise you might want to share your test class as well 😄

    The screenshots are a bit blurry so I cannot see all the import errors but a point to note is that once you mark the java folder within the main folder as Sources Root, you need to change your package statements for all your java files to be package duke; as java would not be part of the package name.

    For your ParserTest.java, once the project is structured correctly, you may refer to option 1 of point 8 in this guide.

    I am not sure why there is an error arising from marking roots but you may consider unmarking all of them first then re-marking them again. Hopefully these will help resolve some of your above issues.

    You might want to try unmarking your src folder as Sources Root and then marking the java folder within your main folder as Sources Root first. Then, check if the directory structure in your java file in the main folder mirrors that of the java file inside your test folder. You shouldn't have to explicitly import Duke in your test class. Use Duke in the test class as you would normally in the main class and a prompt would pop up for you again to rectify the error. See if any of the above helps 😄

    It's not clear where the ui in the run method of your Duke class is coming from. Were you intending to pass ui in as parameter? It's strange that it's not flagged in red with what is seen in the screenshot. It might help to show the relevant files in entirety 😅

    From the point of a user, I believe the second option is more intuitive and friendly. I would probably appreciate it more if every successful operation is saved such that a random crash later on won't affect all previous operations xD

    Edit: On a relevant note, the discussion can also be taken further to discuss how saving/loading is done. For every operation, do you write to the file and then read from it again to repopulate/update the array list of task that you have, or do you have another piece of code to modify the already loaded array list of task?

    I think with the current size of the program and a task limit of 100, this would not matter but scalability wise, if the number of tasks start growing significantly, then it might get expensive to keep reading/writing all tasks from the file.

    1. Save a Task
    1. Delete the storage file
    1. Try to save the task again

    I think this would be handled as an IOException within the method responsible for saving tasks. Ideally the code should re-generate the missing folders/file if they are found to not exist but upon a failed creation (maybe due to permission issues), it should terminate the entire program with a proper exit message.

    I used an empty catch myself but I really love the suggestion from @rajobasu to use regex. In my case the use of regex would make my code for parsing simpler and neater as well so I will probably refactor my code around this, thanks 😄

    If I were to re-generate missing file structures, then I would also need to consider adding previously existing tasks in the list to the file as well, otherwise, there will be a mismatch between what is in the file vs what is in the task list at run-time. This could cause problems as well if the user modifies a task added before the file was re-generated (e.g. mark a task as done in the application, and this task is present in memory but not present in the file on the user's hard drive).

    Now that you say this I didn't actually consider re-generating the file with previously existing tasks even though that sounds like a best case scenario for the user - more patch up to do :'DDD

    You can see the checkstyle violations in the html file but if you scroll up slightly higher the violations are reported directly on the terminal too (and you can click on their links to quickly jump to them).

    Place the import statements for your own classes below those from the java packages and it should be alright 😃

    There's a possibility your Gradle JVM is set to jdk15.

    Go to Preferences (settings on windows) -> Build, Execution, Deployment -> Build Tools -> Gradle

    Check at the bottom if Gradle JVM has been set to jdk15. If it has then change it to jdk11 and regenerate your jar file again with project sdk configured to java 11 😄

    You may also see if this helps with your issue 😃

    There seems to be a lot of deletion going on and I am not sure if this is the best way forward 😅

    To clarify, do you have both checkstyle.xml and suppressions.xml placed under src/config/checkstyle/ ?

    The build.gradle file in your latest commit seems alright but if you have made any changes to it you might want to share them as well.

    Lastly, are you running the check with gradle checkstyleMain checkstyleTest?

    It might be worth to double check/retry the setup again just in case a previous error is causing all these unnecessary deletions 😃

    May I check where you obtained your checkstyle.xml from? I am unable to find the following lines from the checkstyle gotten from AB3:

    
    <property name="allowUndeclaredRTE" value="true"/>
    
    <property name="allowThrowsTagsForSubclasses" value="true"/
    
    <property name="allowMissingThrowsTags" value="true"/>
    
    

    Yup! There's a checkstyle guide in week 4's project here. If you are willing to go to the trouble following this week's guide might just solve all your issues 😄

    @zoeykobe Do you know specifically when this happens?

    Since all your classes are in a single duke package, all you need to do is ensure that all of your java files have package duke; at the very first line and you will be able to refer to the classes directly by their names 😃

    Hello! You might want to double check if you have both checkstyle.xml and suppressions.xml placed under src/config/checkstyle/

    Check your build.gradle file as well and make sure you got your checkstyle.xml from here

    Hello! See if this thread helps you 😃

    There doesn't seem to be anything problematic with this fragment of code, do you mind sharing other relevant parts of the file?

    Where did you place your MainWindow.java file? Did you import it if you placed it in another package?

    Is your stage.show() within your Main file instead of Duke?

    Correct me if I am wrong but I felt the tutorial used Main and Duke interchangeably a couple of times in the third tutorial. In one of the steps they said Main class but their example was showing that of Duke. For the fragment of code you showed in your first post, I believe you might get something if you add stage.show() right after stage.setScene(). If it is convenient and you would like to you can give it a try. Otherwise if the issue is already resolved that's great too 😄

    This is oddly strange all your previous closed pull requests seem to reflect the latest of your code changes. For both the pull requests you mentioned in your first screenshot (and which you have closed), they are both seen to be 40 commits ahead of the upstream master. In the second screenshot, the number of commits also show 40 although it seems the commit lines do not reflect that. Have you tried peeking at your pull requests when signed out/from another browser?

    Seems to be a similar issue to the one posted here. See if the solutions there help 😄

    Check if you imported MainWindow if you used it in a class from a different package 😃

    Hello! Check here for the checkstyle tutorial and retrieve the files here. Place both checkstyle.xml and suppressions.xml within ./config/checkstyle/ 😃

    I bumped into this yesterday while working on part 4 of javafx tutorial. I googled a bit about it but didn't read too much into it except javafx did seem to have a hand in the 'InvocationTargetException' 😛 As far as I can recall I think it "wraps" itself around other exceptions (in your case that would be 'NullPointerException) but if you click on the other exception through the bottom left panel in your screenshot, you should be able to get the stacktrace for the underlying error 😄

    Double check your checkstyle.xml and suppressions.yml are correctly retrieved from here. This thread here has a similar issue and it seems to be related to the checkstyle file contents.

    Edit: Also check your build.gradle file as well 😃

    im wondering whether should i save it as .yml? because the previous post you mentioned suppressions.yml rather than .xml in github

    Please keep it as .xml, it was a genuine mistake and I have edited the reply 😅 Do you mind sharing how you added checkstyle in your build.gradle?

    Is it included in the plugins section as well?

    
    plugins {
    
        id 'java'
    
        id 'application'
    
        id 'checkstyle'
    
        id 'com.github.johnrengelman.shadow' version '5.1.0'
    
    }
    
    

    Alright just to eliminate the possibilities, your checkstyle and suppressions files are placed similar to this?

    Screenshot 2021-02-01 at 10 46 38 PM

    Edit: It's one level above src, I realised I pointed to the wrong path earlier 😦 Really sorry 😦

    Move the config folder out of src (config folder is on the same level as src not within it). Sorry for the confusion 😦

    This is the content of the checkstyle.xml file I am using. By any luck does pasting this into your checkstyle file makes things work for you?

    
    <?xml version="1.0" encoding="UTF-8"?>
    
    <!DOCTYPE module PUBLIC
    
        "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
    
        "https://checkstyle.org/dtds/configuration_1_3.dtd">
    
    
    
    &gt;!--
    
        This configuration file enforces rules for a modified version of the module's code standard at
    
        https://oss-generic.github.io/process/codingstandards/coding-standards-java.html
    
    -->
    
    
    
    <module name="Checker">
    
    
    
      <module name="FileTabCharacter">
    
        &gt;!-- Checks that there are no tab characters in the file. -->
    
      </module>
    
    
    
      <module name="NewlineAtEndOfFile">
    
        &gt;!-- Accept LF, CR or CRLF to accomodate devs who prefer different line endings -->
    
        <property name="lineSeparator" value="lf_cr_crlf"/>
    
      </module>
    
    
    
      <module name="RegexpSingleline">
    
        &gt;!-- Checks that FIXME is not used in comments.  TODO is preferred. -->
    
        <property name="format" value="((//.*)|(\*.*))FIXME" />
    
        <property name="message" value='TODO is preferred to FIXME."' />
    
      </module>
    
    
    
      <module name="SuppressionFilter">
    
        <property name="file" value="${config_loc}/suppressions.xml"/>
    
      </module>
    
    
    
      <module name="LineLength">
    
        &gt;!-- Checks if a line is too long. -->
    
        <property name="max" value="120"/>
    
      </module>
    
    
    
      &gt;!-- All Java AST specific tests live under TreeWalker module. -->
    
      <module name="TreeWalker">
    
    
    
        &gt;!-- Required to allow exceptions in code style -->
    
        <module name="SuppressionCommentFilter">
    
          <property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)"/>
    
          <property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)"/>
    
          <property name="checkFormat" value="$1"/>
    
        </module>
    
    
    
        &gt;!--
    
        IMPORT CHECKS
    
        -->
    
    
    
        &gt;!-- Checks the ordering of import statements follow the rules that the default Eclipse formatter uses.
    
        The order rule "STATIC###STANDARD_JAVA_PACKAGE###SPECIAL_IMPORTS###THIRD_PARTY_PACKAGE" consists of:
    
          1. STATIC: static imports
    
          2. STANDARD_JAVA_PACKAGE: standard java/javax imports
    
          3. SPECIAL_IMPORTS: defined as org imports
    
          4. THIRD_PARTY_PACKAGE: defined as com imports
    
        -->
    
        <module name="CustomImportOrder">
    
            <property name="customImportOrderRules"
    
                value="STATIC###STANDARD_JAVA_PACKAGE###SPECIAL_IMPORTS###THIRD_PARTY_PACKAGE"/>
    
            <property name="specialImportsRegExp" value="^org\."/>
    
            <property name="thirdPartyPackageRegExp" value="^com\."/>
    
            <property name="sortImportsInGroupAlphabetically" value="true"/>
    
        </module>
    
    
    
        &gt;!-- Checks for redundant import statements.
    
        An import statement is redundant if:
    
          * It is a duplicate of another import. This is, when a class is imported more than once.
    
          * The class non-statically imported is from the java.lang package, e.g. importing java.lang.String.
    
          * The class non-statically imported is from the same package as the current package.
    
        -->
    
        <module name="RedundantImport"/>
    
    
    
        &gt;!-- Checks for unused import statements.
    
        An import statement is unused if:
    
          It's not referenced in the file.
    
        -->
    
        <module name="UnusedImports"/>
    
    
    
        <module name="AvoidStarImport"/>
    
    
    
        &gt;!--
    
        NAMING CHECKS
    
        -->
    
    
    
        &gt;!-- Validate abbreviations (consecutive capital letters) length in identifier name -->
    
        <module name="AbbreviationAsWordInName">
    
          <property name="ignoreFinal" value="false"/>
    
          <property name="allowedAbbreviationLength" value="1"/>
    
        </module>
    
    
    
        <module name="PackageName">
    
          &gt;!-- Validates identifiers for package names against the supplied expression. -->
    
          <property name="format" value="^[a-z]+(\.[a-z][a-z0-9]{1,})*$"/>
    
          <property name="severity" value="warning"/>
    
        </module>
    
    
    
        <module name="TypeName">
    
          &gt;!-- Validates static, final fields against the expression "^[A-Z][a-zA-Z0-9]*$". -->
    
          <metadata name="altname" value="TypeName"/>
    
          <property name="severity" value="warning"/>
    
        </module>
    
    
    
        <module name="ConstantName">
    
          &gt;!-- Validates non-private, static, final fields against the expression "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$". -->
    
          <metadata name="altname" value="ConstantName"/>
    
          <property name="applyToPrivate" value="true"/>
    
          <message key="name.invalidPattern"
    
                   value="Variable ''{0}'' should be in ALL_CAPS (if it is a constant) or be private (otherwise)."/>
    
          <property name="severity" value="warning"/>
    
        </module>
    
    
    
        <module name="StaticVariableName">
    
          &gt;!-- Validates static, non-final fields against the supplied expression. -->
    
          <metadata name="altname" value="StaticVariableName"/>
    
          <property name="format" value="^[a-z][a-zA-Z0-9]*_?$"/>
    
          <property name="severity" value="warning"/>
    
        </module>
    
    
    
        <module name="MemberName">
    
          &gt;!-- Validates non-static members against the supplied expression. -->
    
          <metadata name="altname" value="MemberName"/>
    
          <property name="format" value="^[a-z][a-zA-Z0-9]*$"/>
    
          <property name="severity" value="warning"/>
    
        </module>
    
    
    
        <module name="MethodName">
    
          &gt;!-- Validates identifiers for method names against the supplied expression. -->
    
          <metadata name="altname" value="MethodName"/>
    
          <property name="format" value="^[a-z][a-zA-Z0-9]*(_[a-z][a-zA-Z0-9]+){0,2}$"/>
    
        </module>
    
    
    
        <module name="ParameterName">
    
          &gt;!-- Validates identifiers for method parameters against the expression "^[a-z][a-zA-Z0-9]*$". -->
    
          <property name="severity" value="warning"/>
    
        </module>
    
    
    
        <module name="LocalFinalVariableName">
    
          &gt;!-- Validates identifiers for local final variables against the expression "^[a-z][a-zA-Z0-9]*$". -->
    
          <property name="severity" value="warning"/>
    
        </module>
    
    
    
        <module name="LocalVariableName">
    
          &gt;!-- Validates identifiers for local variables against the expression "^[a-z][a-zA-Z0-9]*$". -->
    
          <property name="severity" value="warning"/>
    
        </module>
    
    
    
    
    
        &gt;!--
    
        LENGTH and CODING CHECKS
    
        -->
    
    
    
        &gt;!-- Checks that array type declarations follow Java Style
    
          Java style: public static void main(String[] args) // Allowed
    
          C style:    public static void main(String args[]) // Not allowed
    
        -->
    
        <module name="ArrayTypeStyle"/>
    
    
    
        &gt;!-- Checks if a catch block is empty and does not contain any comments. -->
    
        <module name="EmptyCatchBlock"/>
    
    
    
        <module name="LeftCurly">
    
          &gt;!-- Checks for placement of the left curly brace ('{'). -->
    
          <property name="severity" value="warning"/>
    
        </module>
    
    
    
        <module name="RightCurly">
    
          &gt;!-- Checks right curlies on CATCH, ELSE, and TRY blocks are on
    
          the same line. e.g., the following example is fine:
    
          <pre>
    
            if {
    
              ...
    
            } else
    
          </pre>
    
          -->
    
          &gt;!-- This next example is not fine:
    
          <pre>
    
            if {
    
              ...
    
            }
    
            else
    
          </pre>
    
          -->
    
          <property name="severity" value="warning"/>
    
        </module>
    
    
    
        &gt;!-- Checks for braces around loop blocks -->
    
        <module name="NeedBraces">
    
          &gt;!--
    
          if (true) return 1; // Not allowed
    
          if (true) { return 1; } // Not allowed
    
          else if {
    
            return 1; // else if should always be multi line
    
          }
    
          if (true)
    
            return 1; // Not allowed
    
          -->
    
          <property name="allowEmptyLoopBody" value="true"/>
    
        </module>
    
    
    
        &gt;!-- Checks that each variable declaration is in its own statement and on its own line. -->
    
        <module name="MultipleVariableDeclarations"/>
    
    
    
        <module name="OneStatementPerLine"/>
    
    
    
        &gt;!-- Checks that long constants are defined with an upper ell.-->
    
        <module name="UpperEll" />
    
    
    
        <module name="FallThrough">
    
          &gt;!-- Warn about falling through to the next case statement.  Similar to
    
          javac -Xlint:fallthrough, but the check is suppressed if a single-line comment
    
          on the last non-blank line preceding the fallen-into case contains 'fall through' (or
    
          some other variants which we don't publicized to promote consistency).
    
          -->
    
          <property name="reliefPattern"
    
           value="fall through|Fall through|fallthru|Fallthru|falls through|Falls through|fallthrough|Fallthrough|No break|NO break|no break|continue on"/>
    
        </module>
    
    
    
        <module name="MissingSwitchDefault"/>
    
    
    
        &gt;!-- Checks that Class variables should never be declared public. -->
    
        <module name="VisibilityModifier">
    
          <property name="protectedAllowed" value="true"/>
    
          <property name="allowPublicFinalFields" value="true"/>
    
          <property name="ignoreAnnotationCanonicalNames" value="RegisterExtension, TempDir"/>
    
        </module>
    
    
    
        &gt;!--
    
        ORDER CHECKS
    
        -->
    
    
    
        &gt;!-- Checks that the order of at-clauses follows the tagOrder default property value order.
    
             @author, @version, @param, @return, @throws, @exception, @see, @since, @serial, @serialField, @serialData, @deprecated
    
        -->
    
        <module name="AtclauseOrder"/>
    
    
    
        &gt;!-- Checks if the Class and Interface declarations is organized in this order
    
          1. Class (static) variables. Order: public, protected, package level (no access modifier), private.
    
          2. Instance variables. Order: public, protected, package level (no access modifier), private.
    
          3. Constructors
    
          4. Methods
    
        -->
    
        <module name ="DeclarationOrder"/>
    
    
    
        <module name="ModifierOrder">
    
          &gt;!-- Warn if modifier order is inconsistent with JLS3 8.1.1, 8.3.1, and
    
               8.4.3.  The prescribed order is:
    
               public, protected, private, abstract, static, final, transient, volatile,
    
               synchronized, native, strictfp
    
            -->
    
        </module>
    
    
    
        <module name="OverloadMethodsDeclarationOrder"/>
    
    
    
        &gt;!--
    
        WHITESPACE CHECKS
    
        -->
    
    
    
        &gt;!-- Checks that comments are indented relative to their position in the code -->
    
        <module name="CommentsIndentation"/>
    
    
    
        <module name="WhitespaceAround">
    
          &gt;!-- Checks that various tokens are surrounded by whitespace.
    
               This includes most binary operators and keywords followed
    
               by regular or curly braces.
    
          -->
    
          <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR,
    
            BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN,
    
            EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE,
    
            LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN,
    
            LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS,
    
            MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION,
    
            RCURLY, SL, SLIST, SL_ASSIGN, SR_ASSIGN, STAR, STAR_ASSIGN"/>
    
          &gt;!-- Allow empty constructors e.g. MyClass() {} -->
    
          <property name="allowEmptyConstructors" value="true" />
    
          &gt;!-- Allow empty methods e.g. void func() {} -->
    
          <property name="allowEmptyMethods" value="true" />
    
          &gt;!-- Allow empty types e.g. class Foo {}, enum Foo {} -->
    
          <property name="allowEmptyTypes" value="true" />
    
          &gt;!-- Allow empty loops e.g. for (int i = 1; i > 1; i++) {} -->
    
          <property name="allowEmptyLoops" value="true" />
    
          &gt;!-- Allow empty lambdas e.g. () -&gt; {} -->
    
          <property name="allowEmptyLambdas" value="true" />
    
        </module>
    
    
    
        <module name="WhitespaceAfter">
    
          &gt;!-- Checks that commas, semicolons and typecasts are followed by whitespace. -->
    
          <property name="tokens" value="COMMA, SEMI, TYPECAST"/>
    
        </module>
    
    
    
        <module name="NoWhitespaceAfter">
    
          &gt;!-- Checks that there is no whitespace after various unary operators. Linebreaks are allowed. -->
    
          <property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS,
    
            UNARY_PLUS"/>
    
          <property name="allowLineBreaks" value="true"/>
    
        </module>
    
    
    
        &gt;!-- No trailing whitespace -->
    
        <module name="Regexp">
    
          <property name="format" value="[ \t]+$"/>
    
          <property name="illegalPattern" value="true"/>
    
          <property name="message" value="Trailing whitespace"/>
    
        </module>
    
    
    
        <module name="OperatorWrap">
    
          &gt;!-- Checks that the non-assignment type operator is at the next line in a line wrap.
    
               This includes "?", ":", "==", "!=", "/", "+", "-", "*", "%", ">>", ">>>",
    
               ">=", ">", "<<", "<=", "<", "^", "|", "||", "&", "&&", "instanceof",
    
               "&" when used in a generic upper or lower bounds constraints,
    
                 e.g. <T extends Foo & Bar>
    
               "::" when used as a reference to a method or constructor without arguments.
    
                 e.g. String::compareToIgnoreCase
    
          -->
    
          <property name="tokens" value="QUESTION, COLON, EQUAL, NOT_EQUAL, DIV, PLUS, MINUS, STAR, MOD, SR, BSR,
    
            GE, GT, SL, LE, LT, BXOR, BOR, LOR, BAND, LAND, LITERAL_INSTANCEOF, TYPE_EXTENSION_AND, METHOD_REF"/>
    
          <property name="option" value="nl"/>
    
        </module>
    
        <module name="OperatorWrap">
    
          &gt;!-- Checks that the assignment type operator is at the previous end of line in a line wrap.
    
               This includes "=", "/=", "+=", "-=", "*=", "%=", ">>=", ">>>=", "<<=", "^=", "&=".
    
          -->
    
          <property name="tokens" value="ASSIGN, DIV_ASSIGN, PLUS_ASSIGN, MINUS_ASSIGN, STAR_ASSIGN, MOD_ASSIGN,
    
            SR_ASSIGN, BSR_ASSIGN, SL_ASSIGN, BXOR_ASSIGN, BOR_ASSIGN, BAND_ASSIGN"/>
    
          <property name="option" value="eol"/>
    
        </module>
    
    
    
        <module name="SeparatorWrap">
    
          &gt;!-- Checks that the ".", "@" is at the next line in a line wrap. -->
    
          <property name="tokens" value="DOT, AT"/>
    
          <property name="option" value="nl"/>
    
        </module>
    
        <module name="SeparatorWrap">
    
          &gt;!-- Checks that the ",", "]", "[", "...", ";", "(" is at the previous end of line in a line wrap. -->
    
          <property name="tokens" value="COMMA, RBRACK, ARRAY_DECLARATOR, ELLIPSIS, SEMI, LPAREN"/>
    
          <property name="option" value="eol"/>
    
        </module>
    
    
    
        <module name="Indentation">
    
          <property name="caseIndent" value="0" />
    
        </module>
    
    
    
        <module name="NoWhitespaceBefore">
    
          &gt;!-- Checks that there is no whitespace before various unary operators. Linebreaks are allowed. -->
    
          <property name="tokens" value="SEMI, DOT, POST_DEC, POST_INC"/>
    
          <property name="allowLineBreaks" value="true"/>
    
        </module>
    
    
    
        <module name="ParenPad">
    
          &gt;!-- Checks that there is no whitespace before close parenthesis or after open parenthesis. -->
    
          <property name="severity" value="warning"/>
    
        </module>
    
    
    
        &gt;!-- Checks that non-whitespace characters are separated by no more than one whitespace character.
    
             a = 1; // Allowed
    
             a  = 1; // Not allowed (more than one space before =)
    
        -->
    
        <module name="SingleSpaceSeparator">
    
          &gt;!-- Validate whitespace surrounding comments as well.
    
               a = 1; // Allowed (single space before start of comment)
    
               a = 1; /* Allowed (single space before start of comment) */
    
               /* Allowed (single space after end of comment) */ a = 1;
    
               a = 1;  // Not allowed (more than one space before start of comment)
    
               a = 1;  /* Not allowed (more than one space before start of comment) */
    
               /* Not allowed (more than one space after end of comment) */  a = 1;
    
               This doesn't validate whitespace within comments so a comment /* like  this */ is allowed.
    
          -->
    
          <property name="validateComments" value="true"/>
    
        </module>
    
    
    
        &gt;!--
    
        JAVADOC CHECKS
    
        -->
    
    
    
        &gt;!-- Checks that every class, enumeration and interface have a header comment. -->
    
        <module name="JavadocType">
    
          <property name="allowMissingParamTags" value="true"/>
    
        </module>
    
    
    
        &gt;!-- Checks that every public method (excluding getters, setters and constructors) has a header comment. -->
    
        <module name="JavadocMethod">
    
          <property name="allowedAnnotations" value="Override, Test, BeforeAll, BeforeEach, AfterAll, AfterEach, Subscribe"/>
    
          <property name="scope" value="public"/>
    
          <property name="validateThrows" value="false"/>
    
          <property name="allowMissingParamTags" value="true"/>
    
          <property name="allowMissingReturnTag" value="true"/>
    
          <property name="tokens" value="METHOD_DEF, ANNOTATION_FIELD_DEF"/>
    
        </module>
    
    
    
        <module name="InvalidJavadocPosition"/>
    
    
    
        <module name="MissingJavadocMethodCheck">
    
          <property name="minLineCount" value="1"/>
    
          <property name="allowMissingPropertyJavadoc" value="true"/>
    
          <property name="ignoreMethodNamesRegex" value="(set.*|get.*)"/>
    
        </module>
    
    
    
      </module>
    
    </module>
    
    

    @Yihe-Harry If you are still facing import issues try reloading/reopening the project 😃

    Thank you for the clarifications 😄

    Hi prof @damithc, I would like to make a clarification for point 2.

    Is the capitalisation for instance level final variables strictly not allowed? The example provided in coding standard for a non-static final variable is as below:

    Screenshot 2021-02-02 at 1 25 34 PM

    Thank you in advance!

    I think you are using a third-party test plugin because my dependencies section back while adding JUnit looked only like this:

    
    dependencies {
    
        testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.0'
    
        testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.5.0'
    
    }
    
    

    On a side note, have you tried reloading/reopening the project?

    Assuming you are using scenebuilder, you may want to go to label within DialogBox.fxml file. In the right panel, go under layout and check if it has min, max and pref width/height set to something like this (by default it should all be computed):

    Screenshot 2021-02-02 at 8 32 40 PM

    Your fx:controller: needs to include the full package name e.g. fx:controller:"duke.MainWindow" 😃

    Edit: It seems you are not using packages hold on :3 If you click around on the errors at the bottom left side of your panel, does it not show a full stacktrace of the exception?

    Yup I haven't implemented packages yet, do I need to do that for this to work?

    Nope you don't need packages for this to work!

    Could you share where you are storing your images and how you are referring to them?

    It might help to share your Main and MainWindow files since the error seems to involve line 22 of Main.java and line 23 of MainWindow.java.

    Edit: Might also want to check the image file name in your code since the images you are using have different names from the code provided in the tutorial 😄

    This might be worth a try. Try changing the image paths in 'MainWindow.java' to this:

    '''

    new Image(this.getClass().getResourceAsStream("/images/User.png"));'

    new Image(this.getClass().getResourceAsStream("/images/Duke.png"));

    '''

    And in 'Main.java' file:

    '''

    new FXMLLoader(Main.class.getResource("/view/MainWindow.fxml"));

    '''

    You will need to include the package so for example: duke.Duke 😃

    You might want to double check if you have both checkstyle.xml and suppressions.xml within ./config/checkstyle/. The build.gradle would also need to be updated in case you missed it. Hopefully this also helps :3

    If you click on the html link or scroll up a bit you should be able to see what the violations are. On that note, are you running the test with gradle checkstyleMain checkstyleTest?

    You need to update build.gradle file as well 😄 It's one of the steps outlined here see if that solves the issue 😄

    Do you mean your jar file or code/repository that is not working on mac?

    If you took the checkstyle file from AB3 directly then to be very honest I am not sure as well since the file contents I had were also from AB3 😅. Perhaps it has to do with the way it was retrieved (I copied the raw contents of the file, didn't actually download it).

    @OhJunMing If you click on the link given after See the report at: it will show you all the current code violations. Once you resolve them and run checkstyle again you will no longer see any failure message 😄

    Have you tried reloading/reopening your project?

    Is your Duke class taking in any arguments? If it is you might want to refactor it to not take in any 😃

    Yikes, are you able to push your current code to a separate branch or provide screenshots of the relevant files (build.gradle, Duke etc) and the structure of your project?

    In your Launcher.java, are you calling Main or Duke? I suppose with your current structure, it should be calling the Main class like this:

    
    Application.launch(Main.class, args);
    
    

    In this case, your Main class would be the one extending Application instead of your Duke class.

    Screenshot 2021-02-04 at 11 37 14 AM

    Steve and Zombie 😂

    In your build.gradle file, have you changed mainClassName to the following?

    
    application {
    
        mainClassName = "duke.Launcher"
    
    }
    
    

    Edit: You don't need to write an init method 😃 You will however want to extend Application in Main instead of Duke. To elaborate a bit more, the top level of my package contains the 3 classes Launcher, Main and Duke. Launcher is the entry point and calls the Main class which extends Application. Within the Main class, the start method is overridden and the Duke class is called from Main class.

    If you are using gradle then the compilation should be done with gradlew build or gradlew clean shadowJar depending on which tutorial you followed. If you are using javac I believe third party dependencies need to be specified with the -cp flag.

    https://github.com/Yihe-Harry/ip/tree/gradle-setup-issue

    Just a quick note, the dependencies of your build.gradle file needs to include javafx like this:

    
    dependencies {
    
        String javaFxVersion = '11'
    
    
    
        implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win'
    
        implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac'
    
        implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'linux'
    
        implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'win'
    
        implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'mac'
    
        implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'linux'
    
        implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'win'
    
        implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'mac'
    
        implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'linux'
    
        implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'win'
    
        implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'mac'
    
        implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'linux'
    
    
    
        testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.0'
    
        testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.5.0'
    
    }
    
    

    Hi sorry I'm following this on the tutorial says "Run Launcher and you should see something like this: " followed by a picture, how am I suppose to run Launcher.java then?

    You will see the prompt to run Launcher if you hover beside the class or main method:

    Screenshot 2021-02-04 at 1 05 32 PM

    I have issues locating your Launcher class in the branch you provided (is it not committed and pushed yet?) but if you are calling Duke directly from Launcher, then you need to refactor your Duke class to not take in any arguments in its constructor.

    On a side note, your repository has a number of .class files that are likely a product of the javac command. You might want to clean those up first by going to src/main/java/duke/ and typing rm *.class. The folders in this directory mostly contain .class files as well so you might want to clean them up as you deem fit given that your java files all sit in the same package.

    I see Launcher now 😄 Try refactoring your Duke class to remove the parameters in its constructor and see if it resolves the issue. The simplest way I can think of to quickly test this is to hardcode your folderName and fileName first.

    To be honest I did not face this issue because my Duke class never took any parameters in the first place xD So after you asked, I just dug a bit deeper and it turns out arguments are allowed to be passed, but they are specified in a particular way and requires the import of javafx.application.Application.Parameters;. There is a specific syntax for passing and retrieving the arguments which are neatly outlined here if you wish to explore 😄

    Does this guide help you?

    I am not using @ParameterizedTest myself so I am not too familiar but for a start you might want to standardise the JUnit versions specified in your dependencies first (perhaps to 5.5.0). After which try reloading/reopening your project and see if @ParameterizedTest would be recognised 😃

    If you are getting this error I assume you are on part 4 of the tutorial. In which case. there is a need to refactor the getUserDialog method to take in String in the parameter instead because the code in part 3 of the tutorial actually implemented Label as parameter.

    Edit: A couple of other fields are affected as well such as Image and ImageView. A quick look at the codes from both part 3 and part 4 of the tutorial should reflect the parts that need refactoring 😃

    Not sure if this will be helpful but if you are able to pull up command logs within sourcetree, looking at the commands executed might yield some details (the equivalent of history on the command line)

    Edit: Just theorising here. Based on pure observation alone, in the line Fix coding violations pointed out by peers, there was a 3-branch split into assertions (green), codequality (red) and what appears to be a pseudo master (yellow). Perhaps github/sourcetree have some underlying implementations for pull requests resulting in this yellow branch but I am just making wild guesses at this point. Moving on, my guess of the flow is that assertions (green) branch was first completed and merged into your actual master (blue). A merge was then performed automatically to the pseudo master (yellow) to keep the branch updated. The codequality (red) branch then merges the new commits from the pseudo master (yellow) before merging itself to the actual master (blue).

    If you still face issues see if any of the steps here help you as well! 😄

    It seems checkstyle is the reason you are failing the build, though what I have for the checkstyle section in my build.gradle file is simply the following (without the need for configFile):

    
    checkstyle {
    
        toolVersion = '8.29'
    
    }
    
    

    You might want to see if there's anything here that can help you with the checkstyle issue. Alternatively, the easiest way for everyone to get a full picture of your situation is for you to commit your current code to a separate branch and push it for us to take a look 😄

    The issue might be with the name of the suppressions file. It should be suppressions.xml instead of supressions.xml, give it a try 😄

    Assuming you are using scenebuilder, there is a style section for you to adjust padding:

    Screenshot 2021-02-13 at 1 47 49 PM

    As for how to prevent the truncation in your task list, you may want to go to label within DialogBox.fxml file. In the right panel, go under layout and check if it has min, max and pref width/height set to something like this (by default it should all be computed):

    Screenshot 2021-02-02 at 8 32 40 PM

    Hope this helps 😄

    Googling the error returns quite a number of results that seem to lean the issue heavily towards permissions/dependencies, though they seem to occur mostly on ubuntu. That said for your MainWindow.fxml file, fx:controller="MainWindow" needs to reflect the path to where your MainWindow.java file is sitting at. So in your case it would look like fx:controller="dbot.gui.controller.MainWindow". Hopefully it brings you closer to a solution 😄

    Not sure if this is entirely related but I recall seeing a similar error when a commit was first pushed to the tP fork. Interestingly, re-running the workflow a couple of times with literally no other changes did the magic. Could there be some rate limiting going on? Interested to know this as well 😄

    Just to rule out possibilities, does building your jar file with ./gradlew clean shadowJar help?

    Just to share an observation, I downloaded your final release and tried launching the application via a double click as well as using java -jar apollo.jar. In both instances, I noticed that the data folder was created in the directory of the executable.

    The issue here seems to be similar to the one you are facing, might want to give it a try 😄

    The import for java packages should go above your own packages

    By any chance does running gradlew clean shadowJar help?

    @BigDoot This does not solve your issue but I tried your latest jar release on ubuntu and it works (both through double clicking and running java -jar so there is likely an issue with your ubuntu setup. At the very least hopefully it puts your mind at ease 😛

    Try changing your mainClassName in build.gradle to duke.Launcher 😃

    Ok thank you!

    Not sure what may have changed since your remote repository was last updated 2 days ago but a few points that might help:

    • In your build.gradle try changing mainClassName to duke.Launcher instead.

    • Your images are named as Duke.JPG and User.JPG, try matching the casing as well.

    • Use png files instead of jpg files.

    Hopefully one of the above helps! 😃

    Within your build.gradle file, try changing mainClassName to duke.Launcher instead 😃

    The issue might be in Storage.java. Based on the latest commit on your remote repository, the path for your data storage is absolute. Try a relative path instead 😃

    You may not have modified other test files within src/test but the modifications to the classes within src/main may be the reason for this failed test cases. Seeing as there are only 11 failing test cases, they should be resolvable with more persistent digging. Unfortunately it is a bit hard to tell from the screenshots alone what the causes are. Alternatively, you may push a temporary branch and link it here for others to have a better look. All the best! 😄

    The no newline at EOF error means you need to hit enter after the last line in /src/main/main.iml and /src/test/test.iml to insert a newline at EOF (end of file).

    The warning about trailing whitespace means that at the end of the specified line, there is an extra space that needs to be removed.

    Though on a side note, I noticed my team's tP does not have .iml files present under /src/main and /src/test :3

    Hello! I have been leaving the branches as they are and if there is a need to say update-user-guide again, I checkout to the branch, fetch and merge it with the upstream repository's master branch and then proceed on with the work to be done.

    I personally feel that for a branch, if one is certain that it will be a one-time update, it is alright to delete it (though for the purpose of this module I think they track our branches to see if we follow the forking workflow so better to leave it).

    On the other hand, if there will be constant updates with regards to a particular feature, I would keep the branch there and just be sure to update it before making any further changes. This has been working out for me but I'd like to hear alternatives as well 😄

    Alright thank you for the clarification!

    Hello! If I remember correctly, the notation for a loop should use the word loop instead of for.

    Hello! I am not entirely sure how updates to the documents are tracked but a quick glance across the UG/DG reveals quite a number of occurrences for addressbook. Even if this is not the cause for the dashboard showing red, it might be best to update them to be as relevant to your project as possible 😄

    Hello! Perhaps it might help to share a quick screenshot of the section of the code you modified 😄 On a side note, you may also want to remove the new fields from equals and then try again by adding one new field for comparison every time. This should at least help further narrow down the problem 😄

    Hello! I think this link might help 😃

    I think it depends on the scale of the feature being worked on as well as the approach chosen to work on it. If a small feature was being worked on, then draft requests may not be necessary as pull requests completing smaller features should in theory be more manageable.

    On the other hand, if a feature is big enough to warrant discussion/help, then perhaps that justifies the need for a draft pull request although I am under the impression that it is usually best to break down a huge feature into smaller tasks which then brings me back to my first point.

    All that said I think it is possible to use draft pull requests without constantly failing CI if coding standards are adhered to and the affected test cases temporarily commented out (probably not the ideal practice but a solution nonetheless). Githooks may also be setup locally to prevent instances of commits done without first passing checkstyle and test cases locally (I personally think this helps a lot with reducing unnecessary "fix checkstyle commits").

    I searched a bit after reading your question and came across a very useful link that I have since used to improve the enum in my team's current code base.

    Going with the assumption that the string literals will be used in multiple places, then the general approach I may suggest is as such:

    1. Using an enum for greetings as an example, create an enum class and incorporate the static map index solution from the above link:
    
    public enum GreetingsEnum {
    
        HELLO, HI, HEY;
    
    
    
        //solution below is adapted from the above link
    
        private static final Map<String, GreetingsEnum> index = new HashMap<>();
    
    
    
        //populate the map above
    
        static {
    
            for (GreetingsEnum greeting : GreetingsEnum.values()) {
    
                index.put(greeting.name(), greeting);
    
            }
    
        }
    
    
    
        //for checking if value is present
    
        public static boolean getIfPresent(String greeting) {
    
            return getGreeting(greeting) != null;
    
        }
    
    
    
        //for retrieving value
    
        public static GreetingsEnum getGreeting(String greeting) {
    
            return index.get(greeting.toUpperCase());
    
        }
    
    }
    
    
    1. You may then use it in other places of your code by importing GreetingsEnum and using the static methods. For example:
    
    //to check if a greeting is valid
    
    public static boolean isValidGreeting(String test) {
    
        return GreetingsEnum.getIfPresent(test);
    
    }
    
    

    Hope this helps! 😃

    Our team will explore alternatives to using unicode characters. Thank you for the clarification!

    In that case, would citing personal preferences for a user guide that shows the full screenshot of the application even if the individual components are not hard to identify be legitimate?

    I am mainly thinking that if the primary advantage of using partial screenshots is to ease maintenance (do not have to frequently update screenshots), then the decision to use full screenshots should rest on the developer team (i.e. if the team feels UI updates will not be frequent and wishes to include the full screenshot, it should not be flagged as a bug).

    The above is of course assuming there is no 'harm' done to the users reading the guide which I am doubtful will happen because a full UI screenshot is likely to be even more straightforward.

    Ok thank you for the clarification!

    Yup can confirm that changes the title at the top of the PDF 😄

    Should it be after Friday 10am or Saturday 10am?

    And also a few questions about the PE-Dry Run and actual PE:

    1. Do we only evaluate product + UG? (How about the landing page index.md file?)

    2. Do we evaluate everything in the actual PE (Product, UG, DG, landing page, AboutUs, code?)

    Is there a reason why we do not use Class "&gt;&gt;Interface>>\nNameOfInterface" to draw an interface (so that it is not in italics) instead of the original Interface NameOfInterface &gt;&gt;Interface>> (which gives an italics font)? Will this be considered a bug since italics is supposed to mean abstract classes?

    Class "&gt;&gt;Interface>>\nNameOfInterface":

    Interface NameOfInterface &gt;&gt;Interface>>:

    Hi, just curious if requireNonNull methods are counted for assertions? And do the automated scripts pick only assert keywords to be counted as assertions or are other forms such as requireNonNull, requireAllNonNull and AssertionError counted as well?

    Hi, will like to seek advice for how to approach this issue. So, I am trying to draw the sequence diagram for an add property command, but since the input command string is kind of long (have already omitted optional fields), if I were to put the whole string in the sequence diagram, then the diagram will be very long in width. Hence, I am not sure what is the best way to label it in this case. I have thought that maybe I can omit all the parameters of the functions (such as the parseCommand label below), but this solution seems less than ideal, as it does not help to illustrate the different input string parameters of the respective functions. Hope to get some recommendations here on how to approach this.

    Should there be an association from the LogicManager to Storage as well? Or is it omitted for brevity? Just wondering when is it okay to omit stuff and when we should include.

    Hi, just a quick question, are we supposed to update the contributions of each team member in the DG directly (as stated in the Project tab), or are we supposed to update the contributions in the {github-username}.md file of each member (which will be reflected in the AboutUs rather than the DG?

    Hi, I have been trying to update the Ui class diagram for my team's project, but I can't seem to solve the issue of the overlapping arrowheads. Is the class diagram above acceptable or is there any way to make the lines more spread out and nicer? Appreciate any help. Thanks!

    Why is there an arrow from the Ui component to the Model component? Does the arrow mean a dependency/association or does it mean Ui knows of Model?

    But as seen from the code, Ui only keeps a reference to Logic and does not know of Model?

    Hi, I have a few questions regarding the storage classes implementation in AB3.

    The StorageManager class implements the Storage interface, which in turn extends two other interfaces, AddressBookStorage and UserPrefsStorage. AddressBookStorage interface has 5 methods to be implemented and UserPrefsStorage has 3 methods to be implemented. Even though Storage interface has 5 methods, all 5 of these methods are overriden methods from either of the two interfaces that it extends. Thus, this results in StorageManger having to implement all 8 methods.

    So, firstly, what is the purpose of the Storage interface when the StorageManager class can directly implement the two grandparent interfaces?

    Secondly, if the answer for the first question is to simply provide a convenient API for the user to see, why did the Storage interface only specify 5 of 8 methods?

    (I can understand if 2 of the methods, readAddressBook and saveAddressBook, are omitted because they are overloaded methods that just provide convenience for user to call, but what about the getUserPrefsFilePath method? Shouldn't this getUserPrefsFilePath method be specified in the Storage interface if getAddressBookFilePath is specified too?)

    Sorry for the long question but hopefully someone can enlighten me 😅

    Hi, I realized that in the original AB3 code, when testing the Person class in PersonTest, the code uses PersonBuilder which in turn uses all of the attribute classes such as Name and Phone to build the Person object. So in this case, is PersonTest a form of integration testing? If it is, why is it tested using integration testing instead of unit testing in this case?

    Another follow up question is when do we know if a class should be tested using unit testing (isolated from other class and only uses stubs if necessary) or integration testing?

    Hi, just want to check if we can close the PRs of tutorial-adding-command now because having these open PRs in the team repo may clog up the PR page next time when we have several PRs to keep track of?

    With regard to issue #186, enabling soft wraps can allow for easier reading/editing of long lines in files (in particular the markdown files in AddressBook), by breaking long lines into several lines of screen-width so that there is no need to scroll horizontally in order to see the overly long lines.

    To enable soft wraps in Intellij, can go to Settings -> Editor -> General, and under the Soft Wraps section, check this box:

    Before soft wrap is enabled:

    After soft wrap is enabled:

    Hi, there's a piece of code that I do not understand while trying to read and understand the given code in addressbook.

    In the MainWindow#fillInnerParts method on line 122, CommandBox commandBox = new CommandBox(this::executeCommand); is called and according to the constructor for CommandBox, it takes in a CommandExecutor object. So my question is, why is this::executeCommand an object of type CommandExecutor? I can't seem to understand why is the method reference inferred to be an object of type CommandExecutor.

    The relevant pieces of code is given below for easier reference:

    MainWindow#fillInnerParts method line 122-123:

    MainWindow#executeCommand method:

    Constructor for CommandBox:

    Definition for CommandExecutor under CommandBox.java:

    Hi, just curious if there are any restrictions on the line length in markdown files?

    I know that line breaks do not matter in .md files as line breaks only translate to a space, but what are the benefits of having such long lines over breaking these long lines into say, 120 characters per line? (since the given files in Addressbook are using a single line for almost every paragraph, with some lines going up to almost 1000 characters!)

    Hi, for the user stories and use cases segments under the developer guide, are we supposed to include as many as we can, or are we supposed to include only those that are essential? I think that it is likely to be just including the important ones because the former will likely cause the DG to be overly long. However there are different priority levels assigned to each user story, which make it seem like we should add all of them.

    Hope to seek clarification here. Thank you.

    Hello,

    does anyone know how to update the checkstyle file to match the coding standard for specifically the rule on making all final variables (including member variables) use SCREAMING_SNAKE case?

    There are two errors for the current version of checkstyle

    1. AbbreviationAsWordInName

    I figured we could disable this by updating line 88 in this way:

    Before:

    &gt;property name="ignoreFinal" value="false"/>

    After:

    &gt;property name="ignoreFinal" value="true"/>

    1. MemberName

    Have not figured out how to do this yet. Does anyone know how we can overcome this warning?

    Hi, I have a few queries about the coding standards/discrepancies with checkstyle that I will like to clarify.

    1. Checkstyle complaining about empty line separating 3rd kind of imports (special imports). I realized that javafx imports are considered under special imports instead of third-party imports too. Do we have to strictly follow the checkstyle rules?

    1. Should we make all instance variables that will not be modified final? An example is shown below in which these instance attributes are not modified after the constructor. If they are indeed supposed to be marked as final, then they are supposed to be capitalized too right?

    Extra: Just want to confirm that we should include a fullstop after each description of a parameter in the javadoc comments too? (The module coding standards did explicitly say we should but just wondering why the official Java API actually has both kinds of documentation. The StringBuilder class API uses a fullstop but the Scanner class API does not)

    Hi,

    how do I right-align my user commands to the application window, and also after i resize the window? (The structure is similar to the JavaFX tutorial, in which I have a Label inside a DialogBox(HBox) now)

    Thank you.

    Before resizing:

    After resizing:

    Hello,

    In the class diagram shown, from what I can gather,

    • Each Foo object is connected to 2 other instances of Foo objects

    • Each Foo object has 0 or more Foo objects stored with the variable name bar

    What I think how the sample code for Foo looks like is:

    
    class Foo {
    
        Foo f1;
    
        Foo f2;   // I am assuming that f2 cannot be the same instance as f1
    
        Foo bar;  // bar can be the same instance of Foo as f1 or f2
    
    }
    
    

    However, in the video, it is mentioned that option b is correct even though the bottom 2 instances of Foo are connected to only 1 other instance of Foo. I would think that option b is only correct if the bottom 2 instances of Foo are connected to each other (or some other instances). Can someone help clarify if I am wrong in my understanding? Thank you.

    Hi, may I ask if the java convention disallow empty catch clauses?

    In my use case below, I am allowing users to pass in multiple date/time formats, for e.g. 23/1/2021 1800 and just 23/1/2021. Thus, I created an enum InputDateFormat that specifies different date/time formats (also, is the use of an enum here appropriate?). Then when I try to parse the user input date string, I use a for loop to loop through all the date/time formats (the enums values) and attempt to parse them into a LocalDateTime object. If the first attempt fails, I catch the exception and continue the for loop to attempt to parse again.

    Is this a valid way to use empty catch clauses? Or should I re-implement this design in another way? (Or does anyone have any suggestions on how we can handle multiple date/time formats?)

    Hi, followed the instructions in the JUnit tutorial @se-edu/guides but somehow gotten a package org.junit.jupiter.api does not exist error even though I did follow the guide closely (the code is not highlighted red too).

    Is it possible for someone to share how the ip.iml file and test.iml file should look like because I am not sure if what I have is correct after several attempts to fix stuff. (I think the issue might lie in here?)

    Error:

    My directory has the JUnit5.4 library as shown here

    Hi, anyone knows how does the directory types work in IntelliJ? How important is it to mark a directory as Sources Root(the blue folder)/Test Sources Root(the green folder)? Found some explanations online here and also referred to the official IntelliJ documentation, but still not really sure about what significance it serves. Will the project fail to compile/work if I do not use any of these content roots?

    Tip on how to add/remove past tags from both the remote repo (github) and your local repo through the command line:

    git push --delete origin &gt;tag_name> : removes the tag from the remote repo (github)

    git tag --delete &gt;tag_name> : removes the tag from your own local repo

    git tag -a &gt;tag_name> &gt;commit_SHA1_hash> : to manually tag a commit (as compared to git tag -a &gt;tag_name> which tags the latest commit only). Note that the SHA1 hash of a commit is a 40-character hash that is computed every time you make a commit, and also you only need to specify around the first 8 of the characters of the hash

    An example of the SHA1 hash:

    (An example tag command could therefore be git tag -a Level-8 c0b35c1a)

    Do note that deleting tag in either the remote or local repo does not remove the tag in the other. You have to run both the commands to remove a tag completely from both remote and local repo if you want.

    Hi, just wanted to point out that the assertEquals method parameters has been updated in JUnit 5, with the optional String message being moved to the last position instead of being at the first position. Thus, I believe that the W3.6 video's example on unit testing are outdated as shown in the screenshot below. (the video's first question can therefore have different answer if one follows the official documentation of JUnit 5, as provided here.)

    Hi, just noticed a small typo Taks instead of Task at line 1 under the Duke Level-3 -> Extension: A-classes -> Partial Solution example. And I think there is a need to add a semicolon at the end of line 2 as well.

    Thank you.

    Hi, may I ask if the program output will only be graded in IntelliJ built-in console? I have noticed that IntelliJ supports printing of Unicode characters but Windows command prompt does not (as shown below). Or is there a way to fix this issue?

    (From IntelliJ console)

    (From Windows command prompt)

    Thank you.

    I believe you can add ".gitignore" inside the .gitignore file itself to ignore it (if the .gitignore file has never been commited before).

    However, if the .gitignore file has already been tracked previously, it will still show up in git status. One way to solve this can be to add the ignores to .git/info/exclude in the repository instead.

    (Refer to https://stackoverflow.com/questions/10176875/add-gitignore-to-gitignore#:~:text=gitignore file's purpose is to,be included in the repository for more information)

    As an aside, regarding the iP, I believe we should still commit the .gitignore file actually.

    The product is meant to be used outside of the IDE. As the IDE is a developer tool, the target end users are unlikely to be using one.

    Hi Prof, thanks for the clarification. There seems to be a workaround (using chcp 65001) but it involves the end users changing their system configuration. Since this will inconvenience the users, I think I shall just stick to using the normal hyphen (-) and not use Unicode characters. Thank you!

    You can double check if the JDK location is correct (without any other subfolders behind the jdk-11.0.6). You may also try rebooting your IntelliJ/computer after ensuring the JDK location is correct.

    Also, I am also unable to see my tags at https://github.com/zoeykobe/ip/tags, even though in my git bash if I do git tag it will show me all the tags

    Did you manually push the tags to your remote repository? Tags are not pushed to the remote repository by default. You can try running the command git push origin --tags to push all your tags to the remote repository.

    Hello! I do have more than 1 Java Version installed, Java 11.0.6, 11.0.5 and 8!

    In this case, I think you should remove the other 2 from your PATH under environment variables and try again.

    As for the tags, is it normal that everytime i run git push, they ask for my username and password, and I have to key it in twice because of Logon failed, use ctrl+c to cancel basic credential prompt.?

    Sometimes, the issue may be caused by outdated version of git bash. Try to update your git with git update-git-for-windows if you are using Windows or just git update if you are using mac.

    You may want to refer to this thread for more information (https://stackoverflow.com/questions/55768926/logon-failed-use-ctrlc-to-cancel-basic-credential-prompt-to-git-in-azure-devop).

    Have not implemented this yet, but I am guessing we can use an enum for the commands (e.g. bye, list, todo, event, deadline, etc.)

    Hi! I think that as for this week's tasks it would not be of a great difference to choose either one of the two. However, personally, I prefer to create an object of Duke instead of making its methods and variables static.

    Besides the vry good reasons mentioned by @kormingsoon, my answer would add on more from the perspective of OOP practice. If we use static methods/variables in Duke, it means that the states of Duke can be affected by all the instances of the class. Thus the Duke class is not in complete control of its own states, and those static methods can be seen as methods at a global stage. As a result, the principle of encapsulation is not well followed here and it results in more coupling between components.

    Thus, personally I think creating a Duke object would be better.

    I think this is a very good point raised by @richardcom, as static methods/fields can be accessed by all instances of the class.

    Below is what I think but I am not very sure if my logic/understanding is accurate though. (Please feel free to correct me if I am wrong!)

    What if this chatbot is to be used by multiple users at once? Then the likely scenario is that there will be multiple threads that each create a new instance of the Duke chatbot to engage with the user. However, with static methods/fields, all of the different instances of Duke chatbot will be accessing the same field.

    Take for example, if we have a static attribute static List&gt;Task> taskList = new ArrayList&gt;>(); and static methods addTask(Task task) and printAllTasks(). Then when user A and user B each add a task to their own instance of chatbot and proceed to print their tasks respectively, each user will be able to see both taskA (task that user A added) and taskB (task that user B added) inside their list!!!

    Therefore, I think making the methods and attributes belong to the instance of the class will make more sense in this case.

    Alternatively, we may make use of the .next() from the Scanner object you have created. It automatically takes in the next String in the input, which is the command word in our case. Then, based on the command, we can carry out relevant steps, for example a .nextLine() to read in the rest of the line.

    However, I do agreee with @tjtanjin that his way of splitting may be more elegent during implementation:) Hope it helps in providing another perspective.

    Used this method mentioned by @litone01 as well. However, one thing to note is that if you use .next() to scan for the command first, and proceed to use .nextLine() to scan for the remaining string immediately, then the test script input.txt should end with a newline character as the method .nextLine() is blocking. For e.g. the input.txt file should be something like

    (where the last empty line in the file simulates the user pressing "enter/return" keyboard button)

    Without the last empty line, and if .next() is immediately followed by .nextLine(), the command would not be executed as the .nextLine() call would be blocking to wait for an input that is not there. A workaround without the last empty line may to be check the whether the command is "bye" right after the .next() method, and not calling .nextLine() if the command is indeed "bye". But I do not think this is a good way to code our program.

    However, I do agree that the .split(regex, limit) method provided by @tjtanjin is much more cleaner and simpler! Didn't think of this previously. May want to update my code accordingly too 😅

    @damithc I'm using the terminal in Intellij. Now that I have managed to run the script, may I ask why the expected text is still the "Hello from Duke" instead of the chatbot response? I have attached a screenshot of my output below

    You are expected to update the EXPECTED.txt yourself to match your own chatbot's functionality. The given "Hello from Duke" is just a template.

    It should show from week 3 onwards, similar to the participation marks progress.

    I do not think that using enums for exceptions is wrong by any means, but I do agree that using enums for exceptions does not seem to be the best choice. An enum cannot extend any other class, and in particular, it cannot extend the Exception class (or Throwable class), which means that it will not be able to inherit any methods/fields of the Exception/Throwable classes (and also you won't be able to use the throw keyword too). You will have to implement them yourself if you choose to create a standalone enum.

    Hi @tjtanjin, I believe what you have now is already correct. The latest commit shown in the screenshot above (with hash 83e2ae5) is the result of the merge between the master branch (which was already merged with the branch-Level-7 branch previously) and the branch branch-Level-8.

    java_projects/ip$ git merge --no-ff branch-Level-8

    Auto-merging src/main/java/Command.java

    CONFLICT (content): Merge conflict in src/main/java/Command.java

    Automatic merge failed; fix conflicts and then commit the result.

    When you run this command which attempts to merge branch-Level-8 with branch master, there is a merge conflict and you went on to modify the files and probably ran git add (which marks the file as resolved), followed by git commit (which actually finalizes the merge conflict, i.e. commits it).

    I thus went ahead to resolve the conflicts, add and commit the files within the master branch (kindly advice if this is the correct branch to resolve conflicts on). After committing the modified files and running the merge command again, I was greeted instead with an Already up to date message. Pushing the commits however, did not create a commit message despite me specifying the --no-ff flag earlier. Is this expected behaviour?

    Therefore, when you run the git merge command again, the system prompts you that it is already up to date because the master branch is already merged with the branch-Level-8 branch. I believe after this you do a git push command to push the changes from your local repo to your remote repo and hence you have 4 commits as shown.

    The 4 commits are correct from the steps you took, with their messages originating from:

    1. The commit message from committing in branch-Level-7

    2. The commit message from committing in branch-Level-8

    3. The commit message from merging branch branch-Level-7 with master

    4. The commit message from merging branch branch-Level-8 with master (you probably wrote "Fix: fix merge conflicts" when you finalize the merge command with git commit as explained above)

    Yup sure. I'll close this thread now.

    Thanks @litone01 for sharing, and maybe I can add on by sharing how to add/remove past tags from both github and your local repo through the command line.

    git push --delete origin &gt;tag_name> : removes the tag from the remote repo (github)

    git tag --delete &gt;tag_name> : removes the tag from your own local repo

    git tag -a &gt;tag_name> &gt;commit_SHA1_hash> : to manually tag a commit (as compared to git tag -a &gt;tag_name> which tags the latest commit only). Note that the SHA1 hash of a commit is a 40-character hash that is computed every time you make a commit, and also you only need to specify around the first 8 of the characters of the hash

    An example:

    (an example tag command could be git tag -a Level-8 c0b35c1a)

    Do note that deleting tag in either the remote or local repo does not remove the tag in the other. You have to run both the commands to remove a tag completely from both remote and local repo if you want.

    Sure Prof, I'll open a new issue now.

    Thanks @rajobasu. Can I ask if your junit tests are all working with this 2 files?

    And also is it weird that the

    
    <CLASSES>
    
    ....
    
    </CLASSES>
    
    

    stuff that are present in your ip.iml file is actually inside my test.iml file? (kinda seem like the 2 files swapped contents for mine)

    If you need a third comparison, mine also looks flipped compared to @rajobasu.

    Hi @tjtanjin, would you mind sharing your version of the two files 😓?

    Thanks a lot for your help @tjtanjin!!! So I have compared my ip.iml file with yours and when I removed the line I highlighted (not even sure why it is there in the first place 😞) and ran my Test class again, it worked!!!

    Apart from the json orderEntry lines, everything else is the same for both files except that in my test.iml file, the 2nd line for mine is &gt;module type="JAVA_MODULE" version="4"> instead of your &gt;module type="WEB_MODULE" version="4">. Not sure if this matters?

    Ahhh... I think I am starting to get how the .iml files work (I hope 😅). Just throwing out a hypothesis but it seems the &gt;sourceFolder> tag specifies which modules the .iml file applies to. It should then technically be possible for a single .iml file to apply to multiple modules in a project (hence the multiple &gt;sourceFolder> tag in your original ip.iml). Should that be true, it might be that ip.iml was taking priority (for whatever reason) over your test.iml file, hence triggering the error you saw. I am guessing it would also work if you copy the contents for JUnit from the test.iml file into ip.iml file but since it's working now I guess it's good xD

    Ohh, I think your are right about the &gt;sourceFolder> tag specifying which modules the contents of the .iml file affects. This explains why my previous version is not working. Thanks a lot for your help!!

    In addition, does anyone know whether there is a difference between &gt;module type="JAVA_MODULE" version="4"> and &gt;module type="WEB_MODULE" version="4">? Which of this is the correct version that we should have in our test.iml file?

    On my own opinion, it seems that it doesn't matter for this project. JAVA_MODULE is enough to satisfy the requirement since WEB_MODULE is an extension of the JAVA_MODULE and we don't need any web applications so far. Hope this works!

    Thank you for the explanation.

    @CSmortal You can open up your expand out all your packages by doing this: Press the settings icon right beside your project, and uncheck Compact middle packages.

    Try to unmark all your packages by right-clicking and selecting "Unmark as ...", and then proceed to only mark your java folder in src/main as Sources Root and mark your java folder in src/test as Test Sources Root.

    In addition, you may want to share your .iml files if doing the above still doesn't work.

    Hope this helps 😃

    I have noted that a LocalDateTime object has to have both a date and time field, so when the user pass in only a date format, e.g. LocalDateTime.parse("23/1/2021", DateTimeFormatter.ofPattern("d/M/y")) actually returns an error. In this case, my original for loop will fail too.

    Therefore, I have decided to parse the date and time strings separately and use both a LocalDate instance attribute and a LocalTime instance attribute in my DeadlineTask class to describe the full date and time. Am thinking if just using a simple split method over using regex to parse the input date and time will be better in this case.

    Thanks @rajobasu for the suggestion!

    Thanks for the clarification prof!

    The order of imports should be as follow (from top to bottom):

    1. static imports

    2. standard java imports (imports from standard java api, e.g. import java.util.Scanner, java.time.LocalDate, etc)

    3. special imports (such as imports from your own packages, e.g. import duke.commands)

    4. third party imports (such as from javafx library)

    This is my test.iml:

    This looks correct.

    This is my main.iml:

    It seems weird that you have a main.iml file in addition to the ip.iml file. When did the main.iml file get created? Can you try deleting the main.iml file and check the contents of your ip.iml file?

    You may want to compare it to my ip.iml file, and take a look at the highlighted line (which is different from yours)

    Before i go on, i have another ( noob ) question to ask. How do I resolve this issue of having to put the main.java.duke. in front of every declaration of a class from our java files?

    Add package duke at the top of each of your java files.

    @hengyongming Have you reload your gradle project? After you add dependencies into your build.gradle file, you have to load them first.

    Try pressing this button.

    Maybe it would help if you leave all your previous text-based UI for stdin, stdout and error messages in your code? (so that your terminal will still show what the error is)

    Alternatively, you may want to try using the debugger in IntelliJ.

    Solved it by attaching the fitToWidth="true" property inside the scrollpane.

    Have you changed your MainWindow.fxml to fit the controller name? As from your project structure, in your MainWindow.fxml file, I think that the fx:controller property of your AnchorPane should be changed to fx:controller="duke.UI.MainWindow"

    @Yihe-Harry yes

    Thanks for the clarification prof. Shall leave this thread open a bit longer before closing.

    Yepp sure

    Hi Prof @damithc,

    Is this the preferred way to write the constructor because of the capitalized final instance attributes and camelCase parameter names? Thanks.

    Yes prof @damithc. We can still configure IntelliJ to build/run using Gradle or IntelliJ itself 😄

    @w2vgd I managed to get rid of the warnings by digging the checkstyle.xml and comment out the code block for MemberName (line 120). But I'm not sure if that's allowed.

    Hi @figo2127, just my personal opinion but I would think its best not to comment out that part since it serves to check if all of your member variables are named correctly (those that are non-final too). Although the check is kind of simple as I seen from the regex, i.e. only making sure that the variable name starts with a lowercase and that the name only consist of letters and digits, I think that it may still be useful as a final safety check (given that we have quite a number of files to check, and even more so for tP later on).

    As such, I have reverted to using camelCase for static non-final member variables to comply with the checkstyle rules (because I can't stand the warnings generated by checkstyle 😅).

    Hint 1: For the greeting message, think about how similar it is to your current messages, i.e. what kind of node are you using to display the current messages now and also how are you adding them to your application now. After that, think about the sequence of event that happens when you boot up your application, i.e. the lifecyle of a JavaFX application (I have attached an image below for your reference). Think about when/where you can add that node to your current window 😃

    Hint 2: For the bye message, think about where you can add an additional check for the command passed in by the user. Can the check be done in handleUserInput or should it be done in getResponse? What method can you call to exit the program if the command is actually an exit/bye command?

    Hope this helps 😄

    Still a work in progress! Shall customize it further with personal features later on 😄

    Edit: Personalized it!

    @kieron560 Have you tried changing the mainClassName under application in your build.gradle file to

    mainClassName="Launcher" (assuming you are following the tutorial exactly) instead of the default Duke?

    And also do note that if you are running the application in intellij, you have to run the Launcher class intead of the Main class if not there will be an error that says JavaFX runtime components are missing, and are required to run this application (although I am not really sure what cause this error).

    Is your resources folder marked as Resources Root as shown by the icon below?

    If it is not yet marked, you may want to try marking it as the Resources Root as follows (there should be an option for Resources Root if you have yet to mark it):

    But actually what does marking the folder as Resource Root does ah out of curiousity? And why can Gradle run it fine, but the IDE doesnt seem to know it's a resource folder?

    You may read up more about such content roots from the official IntelliJ documentation here or I also found this stackoverflow answer quite useful to understand.

    Also really ,thanks, but my tests are still goners though... This is my screenshot of my folder structure just in case I didn't mark it again...

    Does your test folder directly mirror the original main folder? In this case, for example, is your structure for your Duke class in the main folder as follows:

    main -> java -> duke -> Duke.java ?

    and similarly for your Event and Todo classes. They have to be in the exact same folder structure as the main folder.

    Hi, I think that the "Trailing Whitespace" error is not caused by the blank lines, but rather it is caused by literally trailing white spaces in the specific line.

    For example, this does not give any checkstyle violations:

    While this gives the "Trailing Whitespace" checkstyle violation:

    (Notice the extra whitespace at the end of line 42?)

    All you have to do is to go to the line as indicated by the checkstyle violation, and remove all the whitespaces that are at the end of the line.

    Or a faster method is actually to right click your java folder, and click Reformat Code.

    Hope this helps 😄

    I checked and there were no extra white spaces before the blank lines. I tried Reformat Code but it does not solve the errors either

    Would you like to share the error message from checkstyle as well as the corresponding line of code so that we can have a clearer picture of your problem?

    Does your line 22 start from the beginning of the line as in this case:

    or it starts from the same indentation as the previous line as in this case:

    Edit(sorry typo earlier on): The first case is the correct version and the second case will give the error.

    Additional tip:

    For people who feel that its annoying to have all formats of todo marked as a TODO item (which will fill up your TODO list with unwanted tasks), what I did was to go to Settings -> Editor -> TODO and format the patterns manually (or you can even delete it). I ticked the case sensitive checkbox and specify the pattern to be all uppercase letters so that only when i type TODO then it will be marked as a legitimate todo item as shown in the image below:

    In addition to comparing just the advantages either streams or loops bring, I think its also worthwhile to look into the disadvantages and also perhaps some "inconveniences" that each brings. I find this stackoverflow post summarizing the advantages/disadvantages quite succinctly. There seems to be a common consensus that loops are much easier to read as many have mentioned above.

    But I was wondering from the industry standpoint, would software engineers tend to be more comfortable with loops or streams? Is there some kind of industry preference out there if any of you guys have an internship experience.

    In particular, the "Familiarity" portion of the answer from the stackoverflow post mentioned that since streams are not available in every language and is a relatively newer concept, I guess loops are generally considered more comfortable for many.

    But of course it still depends on each programmer in the end. And also while working in a team or on a brownfield project, I guess you will still have to follow what others use so that the style of coding is consistent throughout?

    return statements serve as the break themselves, as the function will exit upon reaching the return statement. So I do not think it is necessary to include any break in this code snippet.

    Perhaps you can provide us with some examples on what are the cases that will meet such issues? In my opinion, its far too definite to say that the default case and else clause should be used solely for throwing exceptions/errors.

    public Fruit parseCommand(String command) {

    try {
    
        if (command == "apple") {
    
            return new Apple();
    
        } else if (command == "banana") {
    
            throw new Exception("what is a banana?");
    
        } else {
    
            assert false : "You shouldn't reach this block";
    
        }
    
    } catch (Exception ex) {
    
        // Do something
    
    }
    
    return null;
    

    }

    Do note that you should not use use AssertionError or assert statements to handle invalid user input. Imagine if the user accidentally pass in a command "appl" and then the program crashes because of a small typo, I think that the user will be quite shocked to say the least. The program cannot recover from an assertion error because throwing an assertion error will mean that something has gone horribly wrong in the code at this point and any further execution may likely result in unwanted consequences.

    As what @candyhy has mentioned, you should use exceptions to handle invalid user input and propagate that exception to be handled by the caller parent method instead. There is also nothing wrong with adding that the method throws some exceptions in the method signature too. This is to help you ensure that any method who calls this method will have to handle this exception.

    Okay! Thanks for the clarification.

    Try using .png files instead as what @tjtanjin said and also maybe use the paths like this:

    Either "./images/User.png" or "images/User.png"

    and similarly for other relative paths.

    Since we are all students now, I think that it will be great if everyone's PRs are reviewed by at least one other person. We cannot possibly catch every single error/typo/bug by ourselves. Since we are working in a team, we can use it to our advantage by getting others to vet our own PRs, which can help to minimize such oversights.

    Just my two cents worth 😄

    @vevek This was what I thought initially too, as reading the lines and editing will be much easier with shorter lines. But I guess Prof @damithc raised a very good point about the maintenance of the files in the future.

    Thanks prof @damithc for the tip! This will be very useful for editing the documentation files 😃

    For those who wants to enable soft wraps in Intellij, can go to Settings -> Editor -> General, and under the Soft Wraps section, check this box:

    @damithc Sure!

    Thanks @samuelfangjw for the explanation. I think I understand now. Because method references are a special kind of lambdas, and functional interfaces can be instantiated with lambda expressions, this::executeCommand is just an instantiation of the CommandExecutor interface.

    Implementation-wise for the base AddressBook code, the order of the paramters does not matter at all (even for the optional paramters). I believe you can put the optional parameters at the front too and it will still be parsed correctly by the ArgumentTokenizer and ArgumentMultimap classes. So if you will like to include an additional parameter, the only thing to do is to use a different unique prefix so that the parsing can be done correctly.

    The documentations that you mentioned where optional parameters cannot be followed by required parameters is because for programming languages, I think that this will simplify the design of the programming language as it will be hard to detect when the parameters are not being provided anymore for a function if there are optional parameters before a required parameter.

    However, for AddressBook, since it uses unique prefixes to separate the arguments, we can still pass in the arguments in any way we like. (Someone correct me if I am wrong)

    Okay, thank you Prof @damithc.

    You may like to refer to this guide

    They are triggered by such logging statements in the code:

    Everytime you start the app, or run a command, logging output is printed to such files for logging purposes (think of it as the black box for recording what happened when you are using the app). Every single run of the app will write to such files, and if a single file exceeds 5MB, a new file will be created to continue to record the logging output, for a maximum of up to 5 files. (Not sure what happens after 5 files though, but my guess is it will just not record anything anymore).

    You can delete the log file after every run if you like.

    If you will like to know where the code for producing such a file comes from, it comes from LogsCenter.java

    I had a quick look at the Storage interface. I couldn't think of a good reason to override those 5 methods in there but not the other three.

    Why do we have the Storage interface in the first place? Most likely it was added so that we can see the full interface of the Storage component (which is a main component of AB3) in one place. Then, why have those smaller interfaces that Storage inherits from? Most likely to cater for clients that don't need to see the full Storage interface. Relevant: the interface segregation principle

    Ahhhh I see. Thanks for the clarification prof @damithc. I guess we should update the interface in our own implementation then 😄

    Aren't some GUI components linked to the Model so that the GUI updates automatically when the model is changed?

    Ohh, I see. Thanks for the clarification!

    It is mentioned in the UG that it is intended for the additional input to be ignored:

    👍

    Ohh, I see. Thank you!

    If there is an association, it's best to include it here (given a similar association with the Model is included already -- no good reason for one to be included and the other to be omitted). If confirmed, please report a bug at https://github.com/se-edu/addressbook-level3/issues

    Done!

    Hi, may I ask if this diagram is acceptable? Is the addProperty(property) part alright because property is not actually defined but the Property class is too low-level to show in this sequence diagram.

    Ok! Thanks for the help @Prabhakaran-Gokul and @damithc.

    Are we recommended to use requireNonNull or should we use assert for the script?

    Thanks Prof @damithc.

    Yeahh I realized that in addition to this, there is also a typo in JsonSerializablePerson. It should have been JsonAdaptedPerson instead.

    Thanks

    My team has already made the necessary updates to the UG/DG/Readme files for the TP, yet on the dashboard it still shows as red. Any idea why?

    This is our repo.

    Is it okay if I update checkstyles to v6.3 in the tp?

    The version 5.1.2 which was there initially causes it to not run at least on my machine probably due to me running on Java 15?

    However, this seems odd since Java is supposed to be backwards compatible so having a more recent JDK shouldn't break things... which leads me to believe that it can be some other issue?

    [The above is using checkstyles 5.1.2 and java 15]

    I have compiled my Jar file using java version 59.0 it seems. Is it certain that the testers will also use the latest version? Otherwise the file wont open....

    Wanted to leave this link, its on youtube, released on Feb4 2021 (Very recent), so thought some of you debugging Gradle might find it useful to see from a video.

    Note: It’s on the official IntelliJ channel!

    Screenshot 2021-01-26 at 1 54 41 AM

    I followed these, but this only created a test.iml file inside the /test folder. No test/java folder.

    
    <?xml version="1.0" encoding="UTF-8"?>
    
    <module type="WEB_MODULE" version="4">
    
      <component name="NewModuleRootManager" inherit-compiler-output="true">
    
        <exclude-output />
    
        <content url="file://$MODULE_DIR$" />
    
        <orderEntry type="inheritedJdk" />
    
        <orderEntry type="sourceFolder" forTests="false" />
    
      </component>
    
    </module>
    
    

    This is the code.

    So then I just created a new java folder inside the test directory and marked it as source for testing and changed the forTests to “true”. Is this sufficient?

    Also what all does the test.iml file signify?

    My code already has everything divided/uses slightly differences from the given OOP structure under A-MoreOOP.

    Do I need to change and refactor everything to match the given classnames and OOP-structure? Or is that more of a guideline?

    Just something that came to notice while making some regex on which I spent some time debugging, hence mentioning it here.

    If you want to match “\x” where ’\’ is not an escape character, it should be written as ”\\\\”. First, Strings treat ”\\” as a single ”\”, and so does regex, so we kind-of have to do it twice.

    Hope no one else bugs on this !

    I was trying to split on the given input string but only at the first space. Simple enough to do with substring/findFirstOccurance operations.

    However, how do I do it in shorter/simpler code?

    One option is to figure out some regex using lookbehind. Something like “(?<!\s.*)\s” should work right? However, I was reading that Java doesn’t allow such regexing (or indeed most regex engines).

    I wanted to ask if there is indeed any way to make a regex which does do it?

    (Alternate methods with other library functions which are succinct are welcome as well)

    Screenshot 2021-01-17 at 8 13 49 PM

    The examples are probably opposite, as in the example for the breadth-first should be in the depth-first, and vice versa, right?

    Or is my understanding of these wrong, in which case would be glad if someone clarified!

    Hi Prof,

    That is my understanding as well. But in that case, doesn't "building a new feature fully" mean completing a full component and thus is an example of depth-first ? (and similarly shouldn't "support for a feature to be added in a later iteration" more suitable for breadth-first rather than depth-first?

    Oh okay I think I got it now.

    Thanks a lot prof 😃

    I have mostly used enums with a string property in them, which allows for easy for-each style iteration while determining the type of Event to be generated.

    I feel since the Duke is the main entry point, it should be only used to set up other processes like an Input loop. Everything else should be taken care of other classes, the main method and indeed the Duke class itself should be very minimal! That is usually how I write my code at least.

    Oh right! Thanks a lot for pointing this out. I was under the impression from the documentation that it would only return the first two strings that are matched by the pattern, my bad.

    Still interested in finding a regex way though! Will close the issue later then.

    @marcusleeeugene using enums for exceptions are probably a bad choice (?!), instead those should be ExceptionClasses themselves, like InvalidIntegerException, or EmptyDescriptionException, if you so want it to be!

    Okay, thank you prof!

    https://stackoverflow.com/questions/17211066/intellij-idea-module-default-user-dir

    Does this help?

    Um, I have a question that how do you exactly define static final variables from an external file? The only way I can think of is using constructs like

    
    class A{
    
        static {
    
        
    
        }
    
    }
    
    

    However, is this a good way to do this? What if the thing fails? Exception handling will be hard as well since you have to do everything mostly in these places, so not that modular right?

    Just want to know what the best practices are for these things.

    No I mean, how you were talking about keeping static constants in a .json or something. You will have to load them right?

    I thought forTests should be true since we are using the module for UnitTesting?

    Yea I know about JSON/json loaders but the thing is that where will you put the code for that? since it’s a static final variable, needs to be in static blocks right? But then, assuming all classes usually have some static constants, you can’t really instantiate anything in that case right due to circular logic. So you would end up having to put a lot of the initialisation code inside the static blocks, which don’t feel ideal to me. Agreed that there is a benefit of keeping constants at the same place, but do you even really want that?

    Think about it from another perspective : not all constants are public (and in general most aren't). Putting them in the same place can be dangerous. Secondly, if you want to keep separate files for the constants in different class, might as well just hardcode them.

    Atleast these came to my mind!

    Screenshot 2021-01-26 at 2 39 49 AM

    ip.iml :

    
    <?xml version="1.0" encoding="UTF-8"?>
    
    <module type="JAVA_MODULE" version="4">
    
      <component name="NewModuleRootManager" inherit-compiler-output="true">
    
        <exclude-output />
    
        <content url="file://$MODULE_DIR$">
    
          <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
    
          <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
    
        </content>
    
        <orderEntry type="inheritedJdk" />
    
        <orderEntry type="sourceFolder" forTests="false" />
    
        <orderEntry type="module-library" scope="TEST">
    
          <library name="JUnit4">
    
            <CLASSES>
    
              <root url="jar://$MAVEN_REPOSITORY$/junit/junit/4.12/junit-4.12.jar!/" />
    
              <root url="jar://$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
    
            </CLASSES>
    
            <JAVADOC />
    
            <SOURCES />
    
          </library>
    
        </orderEntry>
    
        <orderEntry type="module-library" scope="TEST">
    
          <library name="JUnit5.4">
    
            <CLASSES>
    
              <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.4.2/junit-jupiter-5.4.2.jar!/" />
    
              <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.4.2/junit-jupiter-api-5.4.2.jar!/" />
    
              <root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.0.0/apiguardian-api-1.0.0.jar!/" />
    
              <root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.1.1/opentest4j-1.1.1.jar!/" />
    
              <root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.4.2/junit-platform-commons-1.4.2.jar!/" />
    
              <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.4.2/junit-jupiter-params-5.4.2.jar!/" />
    
              <root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.4.2/junit-jupiter-engine-5.4.2.jar!/" />
    
              <root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.4.2/junit-platform-engine-1.4.2.jar!/" />
    
            </CLASSES>
    
            <JAVADOC />
    
            <SOURCES />
    
          </library>
    
        </orderEntry>
    
      </component>
    
    </module>
    
    

    test.iml :

    
    <?xml version="1.0" encoding="UTF-8"?>
    
    <module type="WEB_MODULE" version="4">
    
      <component name="NewModuleRootManager" inherit-compiler-output="true">
    
        <exclude-output />
    
        <content url="file://$MODULE_DIR$" />
    
        <orderEntry type="inheritedJdk" />
    
        <orderEntry type="sourceFolder" forTests="false" />
    
      </component>
    
    </module>
    
    

    By the way, Also maybe try to make the Java folder inside test as “source of all tests” — there is an option like this in intellij. Maybe that’s the issue?

    By the way, is the following true?

    • check only methods which are returning something — ie very modular.

    • if method is not functional, then it means it is a series of steps which should be clear from the method name itself so why test? If there is additional computation, maybe just shift it to other methods and repeat step 1.

    You might also want to look at try-with-resources, which basically closes AutoClosable objects automatically.

    Second, @georgepwhuang mentioned about garbage collectors, related to that is the finalize() method as well.

    It is called just before the object is to be garbage collected. However there is a caveat here. Look at the following code:

    
    Class A {
    
        static A ref = null;
    
        static boolean x = false;  
    
        public void finalize() {
    
            if(x) {
    
                
    
                  // close some stuff ( —— line (1) )
    
                return;
    
            }
    
            A.ref = this;
    
            A.x = true;
    
        }
    
        public static void main(String… args) {
    
            A a = new A();
    
            a = null;
    
            // force garbage collector, lets say (even though you can’t do it, but just for argument) to garbage collect the object.
    
            a = A.ref;
    
            A.ref = null;
    
            // again force gc.
    
        }
    
    }
    
    

    You would assume that the line(1) would be called atleast once right?

    Turns out no!!!

    The first time the object is garbage collected, we forcefully keep a reference. So it is not garbage collected.

    The second time, that garbage collector doesn’t call finalize() at all!

    It’s only called the first time the object is about to be garbage collected. ONLY THEN.

    As a corollary, I also showed how after calling finalize, the garbage collection might get botched altogether!

    Screenshot 2021-01-28 at 3 25 43 AM

    An example of how it should look like after you follow @tjtanjin ’s comment.

    I believe that in this specific scenario, there are two things we can essentially do:

    • As OP mentioned, we can leave it as a blank catch since it doesn’t make sense to do anything with the exception. Indeed, upon some digging this might also be the Oracle recommended way? Look at this article, seems like there is no testParse() function available anyway, the main way to deal with this error is throwing an exception.

    • Second, which I think is better albeit tedious, is to fix the input to a particular format and then regex it yourself before making a LocalDateTime from it, since throwing Exceptions is a very costly thing to do in a program just like that.

    In general, Exceptions are supposed to deal with exceptional situations, which is not so in this case obviously. Hence, they in general should be dealt with by a non-empty code block.

    I think you have to tag the commit with A-Jar as well.

    objects have a function called .equals().

    You need to override that in your object. Right now they only match the memory location of the object which is obviously different since these are two different objects.

    @colintkn I assumed you didn’t want to download additional stuff 😛

    Yes, the methods mentioned in the link might have been better ways to match, can download those.

    There are two perspectives to this problem I feel:

    • From a user standpoint, saving every change is obviously optimal. I feel we should give the user a choice to save only when pressing save, or save automatically (as is the case in many applications).

    • Is it fast if there is a lot of changes?

    Well, naivest way to do is every time you load all the tasks in the memory, do wtvr the user asks you to do, and before exiting just save everything to the file.

    • this is bad becoz if user terminates by some other way, all changes are lost.

    • Good becoz it is fast since everything is done in memory

    Second way is to do the same thing but read/write again and again everytime a single operation is done

    • this is good bcoz robust

    • bad becoz VERY slow and nonscalable.

    Next method is in the file, instead of reading/writing everything, save the commands themselves. This will allow you to not write everything, but just append to the end of the file the new commands. Again we can do this in two flavours, either add after every user operation, or add at the end. (or maybe add at certain time intervals — maybe by having a separate Thread for this instead of doing on the main process thread).

    • Robust, user doesn’t lose information

    • Writing is fast since we are appending new information instead of rewriting everything.

    • Reading is costly becoz we read all operations performed before instead of all tasks. This is not an issue now since per task we can do atmost 3 operations — insert, markAsDone and remove. so #operations = O(#tasks). But this might not be so always.

    • Reading the first time is also costly, but not prohibitively so.

    Could you please provide a higher resolution screenshot thanks!

    EDIT

    Might want to follow this

    I assume you were checked out at A-CodeQuality when you did a new branch? That is the only way this happens. However this makes me confused as to what the yellow line is.

    Below is how my structure looks like for reference.

    Screenshot 2021-02-09 at 6 48 17 PM

    By the way one thing, which bracnh is checked out currently? master right?

    I had a question (a bit tangential from the main post, really sorry for that). I checked @CharlesLee01 ’s code, there are two main methods one inside Duke and one inside Launcher. How does Java determine which main method to call? Secondly how does changing the mainClassName inside build.gradle help? If the main method is changed, shouldnt the entire program change? (ie, one was text-based vs one was UI based).

    Again, sorry for going on a tangent.

    Essentially the thing is to remove everything that uses that particular class/variable whatnot. Safe delete is just deleting all occurences, and you have to manually change the places which uses that particular class/variable.

    From IntelliJ :

    Screenshot 2021-02-16 at 8 26 04 AM

    Take a look at this post maybe?

    I think streams also help in writing lesser code? I personally find them very easy to manage.

    However some differences :

    • streams are lazy while loops are eager!

    • while optimising your code, loops can be parallelised and vectorised by the compiler much more easily than streams

    If I am not wrong, the break s wont compile at all -- java will mark it as an unreachable statement.

    This might be helpful?

    Wait quizes are due at midnight? I guess this answers my doubts as to why I got 2/3 in last week’s quiz even though I did it on monday 😦

    I guess just better to treat the deadline as on Sunday?

    This seems not to be possible since it is essentially determined at compile time. So you can create a new jar file using a downgraded compiler version but I doubt it is possible to downgrade after the JAR has been created.

    This thread also seems informative.

    I believe one way to tackle might be to squash similar consecutive commits together like in @damithc ’s example?

    Ah, we were thinking of doing this on an incremental basis, as in removing the addressbook references as and how we updated the different parts. But okay will do this and see if its better.

    Just to add on maybe but one example when it definitely won’t have a name : lambda functions/Anonymous Inner Classes!

    If we want to draw them, we can’t really associate names right?

    Hi I cannot open my jar file on my mac, (was working with my PC for duke) it seems like a java version conflict error

    Here is my gradle version, down below it says is using java 11

    Here is the error on my mac

    How can I solve this?

    Hi, checkstyle gives me this error:

    [ant:checkstyle] [ERROR] C:\repos\ip\src\main\java\duke\task\TaskList.java:98:28: Array brackets at illegal position. [ArrayTypeSt

    yle]

    line 98: String eventArr[] = userInput[1].split(" /at ", 2);

    How should I fix this? thank you! 👍

    Hi, I'm getting a lot of errors from checkstyle saying:

    Import statement for 'java.util.ArrayList' is in the wrong order. Should be in the 'STANDARD_JAVA_PACKAGE' group, expecting not assigned imports on this line. [CustomImportOrder]

    My import statements are:

    package duke.task;

    import duke.exception.DukeException;

    import duke.ui.Ui;

    import java.util.ArrayList;

    import java.util.List;

    import java.text.ParseException; //to handle date and time

    import java.text.SimpleDateFormat;

    import java.time.LocalDate;

    import java.time.format.DateTimeFormatter;

    How should I put it correctly? And what is checkstyle wants me to do???

    Hi, I followed the tutorial about the MainWindow.java file, and I got this error.

    This there a quick fix to this?

    Seems gradle does not work on my mac after I copy and paste the code into build.gradle. I got error saying my "import javafx.application.Application;" cannot find the symbol.

    What am I suppose to do here from the javafx tutorial ah?

    "From Run > Edit Configurations, add the following line into your VM options for each of the main classes.

    --module-path {JAVAFX_HOME}/lib --add-modules javafx.controls,javafx.fxml"

    When I opened Run > Edit Config and pressed the + button, this showed up. Which one shall I choose?

    Also, is it we only need to use one of the instructions for setting up javafx? But I copied the code into my build.gradle, and still cannot import the javafx features.

    Hi, when I tried to set up checkstyle using checkstyle.xml on IntelliJ, I cannot find the file checkstyle.xml in my local directory...

    do we create the folder by ourselves?

    I got this error:

    hi, I tried follow the forum but the issue is still there.

    I choose 8.29 in checkstyle, and in my build.gradle also

    im wondering whether should i save it as .yml? because the previous post you mentioned suppressions.yml rather than .xml in github

    checkstyle {

    toolVersion = '8.29'
    

    }

    yes

    yes

    hi i moved the folder, but the issue remains

    hi, somehow copying and pasting to my checkstyle solves the issue. Thank you for your help!

    It’s when I try to follow the next step in the tutorial where need import to the duke file, then it throws me error for cannot find symbol

    yes

    What I did is just follow the tutorial, copy paste the code into build.gradle, then into duke.java, and create Launcher.java. Then when I try to compile Launcher.java with "javac Launcher.java" it throws error saying error: package javafx.application does not exist

    I followed ur instruction and now I have Error: JavaFX runtime components are missing, and are required to run this application"when running gradlew run

    Hi this solved my last error, but I still cannot compile Launcher.java

    Hi TA and prof, I pushed my code to this branch: https://github.com/Yihe-Harry/ip/tree/gradle-setup-issue

    Hi sorry I'm following this on the tutorial says "Run Launcher and you should see something like this: " followed by a picture, how am I suppose to run Launcher.java then?

    Hi I tried to run it and it throws me this error:

    Hi sorry. Ive pushed it again, https://github.com/Yihe-Harry/ip/tree/gradle-setup-issue/src/main/java/duke

    OMG thank you! It works now. May I know the reasoning behind this? Thank you!

    String[] eventArr = userInput[1].split(" /at ", 2); is the answer, though I don't understand what's the propose of this

    Hi, same issue here, how can I downgrade the jar file to java 11 ah?

    Hi I tried after changing to java 11 but still doesnt work.

    yes, more or less

    hi sorry but there is no change

    I believe it is supposed to be finally instead of catch.

    After saving our group's user guide as PDF, we realized that some sections cannot fit into one page and on the second page, there will be blank spaces. The next section will carry on at the start of a brand new page. For example, there is a blank space after the following screenshot, and the user guide continues on from the top of the following page.

    Question: will this be counted as a formatting bug during PE/assessment?

    LOD says this is bad:

    
    Class A {
    
       void doStuff(B b) {
    
           b.getC().doCStuff();
    
      }
    
    }
    
    Class B {
    
       C c;
    
       C getC() {
    
          return c;
    
      }
    
    }
    
    

    I can understand why that is the case, but on second thoughts I wonder when the above code is refactored in the following way, is it really better?

    
    Class A {
    
       void doStuff(B b) {
    
           b.doCStuff();
    
      }
    
    }
    
    Class B {
    
       C c;
    
       void doCStuff() {
    
          getC().doCStuff();
    
      }
    
    }
    
    

    Pros

    • If calling doCStuff method is common, then b.doCStuff() is more convenient than having to use b.getC().doCStuff() all the time.

    Cons

    • Sometimes it may not feel right to have such a doCStuff method within class B?

    I believe as prof mentioned... Source code is not a book but a movie, so the last option should not be set as correct?

    (albeit source code is a movie that I would recommend to anyone)

    Under Week 9 topics

    • 9.2 activity diagram > UML Activity Diagrams → Basic Notation → Alternate Paths

      • Exercises > Which activity diagrams are correct?

        • Which of these activity diagrams use the correct UML notation?

    Last option should be vi

    I remember the times when I have to explain why I would prefer and recommend the first approach to the second approach but was not able to come up with an elegant explanation.

    Namely:

    • Why do List&gt;Integer> tags = new ArrayList&gt;>(); instead of ArrayList&gt;Integer> tags = new ArrayList&gt;>();

    • Why do Set&gt;Tag> tags = new HashSet&gt;>(); instead of HashSet&gt;Tag> tags = new HashSet&gt;>();

    Interface segregation principle (ISP) seem like one of the good reasons to use to explain this preference.

    No client should be forced to depend on methods it does not use.

    So like the example mentioned in the textbook, we may want to avoid depending on concrete implementations of Abstract Data Types (ADTs) such as ArrayList and HashMap if we are not using any specific methods relating to those classes. Instead, we should use List/Map/Set interfaces.

    Hope this helps if you ever need to explain it 👀

    The BankSystem expects Account to throw an exception if i is not within the range of 0 to 100 (both exclusive). While B is definitely correct and C is definitely wrong, I feel uncomfortable saying that A follows LSP.

    • if i is 100, BankSystem expects Account to throw an exception, but AccountTypeA will not.

    • Perhaps an alternative example will be more suitable?

      • method Boolean hasAccount(int i) will return true if 0 > i > 1000, return false otherwise.

      • AccountTypeA returns true if 0 > i > 1000, false otherwise, hence does not follow LSP

    Hi guys, I was reading through the topics for this week and there was this Bi-directional association in the video, specifically:

    Class Box has a Lid & Class Lid has a Box. (See screenshot below)

    Another similar situation is that sometimes we may want a quick way to pass a reference of the "producer" to the thing that is being "produced". For a slightly different example, one may have a BookStore class that contains a method that returns a Book as follows:

    
    class BookStore {
    
        // other details omitted
    
        Book randomBook() {
    
             return new Book(this, "The Great Gatsby");
    
        }
    
    }
    
    

    So in this case, while a BookStore may not have a direct association to Book, BookStore has a dependency on Book (correct me if I am wrong here). And Book has a direct association to BookStore

    So in this case, BookStore points to Book (via dependency) and Book points to BookStore (via association). (Reading the textbook tells me that association is really just dependency.)

    In gist, my question is:

    Does it matter that we have a design that involves a bi-directional relationship between objects?

    • Both objects are associated with each other.

    • One is associated with the other while the other depends on the former.

    • Both objects are dependent on each other.

    Is it a situation where this is unavoidable, or that we should try to avoid it as much as possible, or it simply does not matter at all in terms of having good software design?

    Hello, just browsing through the inherited TP code and I saw this weird line that invokes super() in the concrete implementation of the Storage interface, within the StorageManager class (line 23 -30):

    
        /**
    
         * Creates a {@code StorageManager} with the given {@code AddressBookStorage} and {@code UserPrefStorage}.
    
         */
    
        public StorageManager(AddressBookStorage addressBookStorage, UserPrefsStorage userPrefsStorage) {
    
            super();
    
            this.addressBookStorage = addressBookStorage;
    
            this.userPrefsStorage = userPrefsStorage;
    
        }
    
    

    While I understand that calling super() invokes the parent constructor, in this particular case, it seems to do nothing?

    P.S. I Googled it and found this stackoverflow post which seems to confirm my suspicion. Wonder if anyone knows of any other reason why the super() is there?

    Hi guys, recently I had quite a few discussions with others on interfaces and why do we need them.

    Browsing through our textbook doesn't seem to provide me with adequate reasons why interfaces are needed. I acknowledge that interfaces do the job of specifying certain common behaviours that classes can share and allow for (multiple) inheritances and expressing is-a relationship in OOP fashion. However, it seems that besides multiple inheritances, abstract classes can do the job of interfaces just as perfectly. Also while researching for an answer, I found a casual comment by Robert C. Martin (Uncle Bob) in one of his videos that interfaces are a lousy way of solving multiple inheritance issues in Java.

    If I may quote some discussions that came up in my TP team chat:

    "only good for implementations like list, collection etc" @ong6

    "interface ... enforces methods on whoever implements them so it's like a safeguard?" @tjtanjin

    and myself:

    "I think the use of interfaces is more when you have client-facing code, example a manufacturer will probably provide interfaces that tell software companies that want to make compatible software for this hardware that it needs to implement the certain interface in order to make the parts move etc"

    At the end of it, I am not convinced and also not sure if the above discussions do justice to what interfaces are really for. Other possible reasons that I know of are that interfaces seem to be important for inverting dependencies and also the principle of programming to an interface.

    So my questions are:

    Can someone provide a succinct example to illustrate why do we need to use interfaces? And if we do, why not go with abstract classes??

    Hi guys, I am trying to update the developer guide of our team repo and I am faced with an issue.

    Suppose now that I have done the task of remove all irrelevant content of the developer guide inherited from AB3, and I created a PR from my update-developer-guide branch. Now while waiting for my teammates to approve it, I want to start working on adding user stories to the developer guide. Should I

    1.work on a new commit that is under the existing PR branch (update-developer-guide)?

    Or

    2.create a new branch (update-developer-guide-user-stories) and make my changes there?

    My concern with No.1 is that if I have completed my second task of updating user stories before the PR gets merged, the PR will then complete two tasks (remove irrelevant content and add user stories). Not sure if this is fine and I will also need to update the PR description. And if the PR gets merged before I complete my second task, I will make another PR will the existing branch, not sure if this is a good practice.

    My concern with No.2 is that I might potentially have to make multiple branches trying to do similar things, not sure if this is a good practice.

    Any thoughts on the above or if you would like to share your workflow? Thanks in advanced!

    Hello, would like to point out a very minor typo in the instruction right before

    [W7.2] Design: High-Level View:

    Thank you.

    
    import java.util.regex.Matcher;
    
    import java.util.regex.Pattern;
    
    
    
    Scanner sc = new Scanner(System.in);
    
    String line = sc.nextLine();
    
    
    
    Pattern p = Pattern.compile("^(\\S+)\\s(.*)$");
    
    Matcher m = p.matcher(line);
    
    if (m.find()) {
    
      System.out.println(m.group(1));
    
      System.out.println(m.group(2));
    
    };
    
    
    
    // Works for this primitive test case
    
    // Sample input
    
    // todo regex tasks
    
    
    
    // Sample output
    
    // todo
    
    // regex tasks
    
    

    Using Pattern and Matcher does work, although solutions such as the one given by @tjtanjin seem to be more succinct 😃

    Have you tried invoking these two lines to terminate JavaFX?

    
    Platform.exit();
    
    System.exit(0);
    
    

    Reference: https://docs.oracle.com/javafx/2/api/javafx/application/Application.html

    Agree with @vevek! Can confirm I used System.exit(0) and it works fine for me too. From this stack overflow discussion seems like having both Platform.exit() and System.exit(0) may actually be unnecessary. Relevant comment:

    I just want to point out that in this case the stop() method won't be called at all (at least with JavaFX 8 on windows) because System.exit() closes everything too early. In this case you might just call System.exit() only. But if you want to do something in the stop() method, I would recommend calling Platform.exit() here and System.exit(0) at the end of the stop() method if needed.

    You are right about not needing to have both:) I have tested and can confirm that having just Platform.exit() works. And as mentioned by @vevek and @samuelfangjw , having just System.exit(0) works as well.

    According to the stackoverflow post, I believe calling Platform.exit() might be more suitable for cases where we still want to execute some pre-shutdown, perhaps non JavaFX related operations, other than that it shouldn't make any difference(cmiiw).

    In general:

    • If the two changesets are unlikely to cause a lot of conflicts, you can do them in parallel. It doesn't matter which PR is merged first.
    • If you anticipate lot of conflicts between the two changesets, or one depends on the other, it makes more sense to wait until one is merged before starting on the other.

    In this particular case, get the first PR merged quickly as it is one of those initial morphing tasks that are better done early and quickly because most subsequent work will depend on it. Ask others to review quickly (no need for everyone to review though, just 1-2 reviews will do) so that it can be merged quickly.

    Got it, thanks prof!

    As mentioned in the module website:

    User stories: This can include user stories considered but will not be included in the final product.

    Use cases: Give use cases (textual form) for a few representative user stories that need multiple steps to complete.

    I believe having some representative ones will do for now, as they can evolve and be added later on in the process of development. Requirements change all the time... 😄 (Correct me if I am wrong)

    Hello, perhaps you might want to leave this in at the top of your UserGuide.md?

    Something to try: remove it and see if it makes any difference.

    Running the application with & without it seems to have no observable differences that I can tell. Tests are fine as well. I guess I will conclude that the call to super is unnecessary for now.

    An explicit call to super(...) is needed only if the parent class doesn't have a parameter-less constructor

    Hi prof, could you explain the above statement? I don't understand why there is a need to call super() if the parent class doesn't have a parameter-less constructor.

    Thanks guys for contributing to this discussion. I think I overlooked the details when I thought about the issue, which I will now add below the extracted statements from sources that I just found:

    • If no constructor is defined in a class, Java compiler automatically create a no-argument (no-arg) constructor, that simply issues a super() call

    • The default no-arg constructor will not be automatically generated, if one (or more) constructor was defined. In other words, you need to define no-arg constructor explicitly if other constructors were defined.

    • If the immediate superclass does not have the default constructor (it defines some constructors but does not define a no-arg constructor), you will get a compilation error in doing a super() call. Note that Java compiler inserts a super() as the first statement in a constructor if there is no super(args).

    • Java guarantees that the constructor method of a class is called whenever an instance of that class is created. It also guarantees that the constructor is called whenever an instance of any subclass is created. In order to guarantee this second point, Java must ensure that every constructor method calls its superclass constructor method. Thus, if the first statement in a constructor does not explicitly invoke another constructor with this() or super(), Java implicitly inserts the call super(); that is, it calls the superclass constructor with no arguments. If the superclass does not have a constructor that takes no arguments, this implicit invocation causes a compilation error. docstore.mik.ua/orelly/java-ent/jnut/ch03_04.htm

    I will just walk through this example from a StackOverflow post, to convince myself of this fact that I am unaware of until today😓

    
    public class Base {
    
       public Base(int foo) {
    
       }
    
    }
    
    
    
    public class Subclass extends Base {
    
       public Subclass() {
    
          super(15);
    
       }
    
    }
    
    

    If the constructor of Subclass does not include the super(15) call, Java will implicitly insert super() in the first line of the constructor, which will cause an issue in the case where the Base class does not have an parameter-less constructor(Base()), which unfortunately will not be automatically generated because there is an existing constructor(Base(int foo)).

    Sources:

    While discussing this topic, keep in mind that these two things are not the same:

    1. The general concept of an interface, as in separate the interface from the implementation.
    1. The Java construct called interface.

    The latter is only one way to implement the former in Java. Some languages (e.g., C++) don't even have a construct called interface in which case an abstract class can be used to achieve the same. Likewise, you can use an abstract class to act like an interface in Java too.

    But as @YuFeng0930 mentioned, there are some situations where you have to use an interface and not an abstract class due to the way Java works. So, it's a matter of looking at features/limitations of each and choosing the one that fits. But don't let that choice worry you too much; you can always replace one with the other if things didn't work out as you expected 😃

    Thank you. The main reason why I was confused is indeed speaking about interfaces both as a Java language construct and as an abstraction concept. Will close this issue for now until I have more questions on this topic 😄

    I think remembering the parameters and also their orders of a function is one of those things that can confuse and trip people up fairly easily. Having optional parameters at the end could possibly reduce that as we generally have a more instinctively understanding that parameters when listed, usually should be included unless stated otherwise. And when parameters are optional, they tend to be listed at the end. (Of course, one alternative to this, like what is typically done in Flutter, is to use named parameters).

    Therefore, for example, for those who just want to use a function, they can quickly read through your documentation of the method and see that the first two parameters meet their needs and the last (third) parameter is optional, and then they can go ahead and call the functions with the two parameters accordingly. In this case, they can totally "forget" about the existence of the optional parameter and still invoke the function correctly. However, if the function has an optional parameter in the middle, even if people want to simply invoke the function without the use of the optional parameter, they need to keep that optional parameter in mind and actively take note of the order of parameters to include, so as to avoid putting the parameters in the wrong place.

    Just my 2 cents.

    It's usually a case of pros and cons. So, what are the benefits of bi-directional associations?

    For cons:

    • Cyclic dependencies make it hard to test as both classes need to know that the other class exists and is compilable.

    • Changes in one class might break the other class.

    For pros:

    • The remotely plausible reason that I can think of is that having two smaller classes (even though in a bi-directional relationship) is at least better at closely modeling the interaction and real-life relationships between the two objects, as compared to one large class, hence more OOP?

    • Convenient.

    Any hints for the benefits of having bi-directional associations?

    Ok got it. The part on referential-integrity is something that I didn't realize but could in fact be disastrous if that's not accounted for.

    Can I say that association classes are a good alternative to bi-directional associations?

    pros:

    • Remove the cyclic dependency.

    cons:

    • Less convenient and potentially require more checking to ensure updates are made to reflect the new state of the program.

    Author ---> Authorship >--- Book

       &gt;---            --->
    

    I have this in mind when I refer to the association classes:

    Though this way the association class Authorship does not have a bi-directional relationship with the other two classes, I would imagine that adding, updating, and querying of the relationship between Book and Author will be troublesome... Thanks for the food for thought.

    I use the solution of git fetch and then git checkout branchName and it works fine to achieve the goal of cloning and tracking the remote branch into the local repo.

    For the first part, I interpret what you are trying to do as follows:

    • make a list of enum types

    • check if the user input is valid if it is within the list of enums

    On top of the suggestion given by @tjtanjin, maybe I will just add an alternative to achieve the above result if you use streams and make the enum like this:

    
    enum ResidenceAbbreviation{
    
        PGPH("PGPH"),
    
        PGPR("PGPR"),
    
        // and others
    
    
    
        private String text;
    
    
    
        ResidenceAbbreviation(String text) {
    
            this.text = text;
    
        }
    
    
    
        public String getText() {
    
            return this.text;
    
        }
    
    }
    
    // testing
    
    String test = "userInput";
    
    
    
    Arrays.stream(ResidenceAbbreviation.values())
    
          .map(ResidenceAbbreviation::getText)
    
          .anyMatch(x -&gt; x.equals(test));
    
    

    After using it myself and also with @tjtanjin, I think draft PR is a good way to inform your teammates that you are working on certain tasks/features and this might save some typing (as an automatic email will be sent to notify everyone about the PR).

    One possible drawback is that whenever a commit is updated in the draft PR, an email will be sent to your teammates as well. This might be deemed as unwarranted/unnecessary noise to some.

    The first method is obviously faster but prone to bugs since if no checks are done in the application itself, we might not know if someone's change broke anything.

    I feel that this point would largely go away with sufficient amount of test code. Since CI has been setup, we should have a decent amount of confidence that if it passes, that should imply that there are no breaking changes unless the PR disabled some test code or broke the test code itself, which is quite evident when looking at the code. Of course all these are on the assumption that there exists sufficiently good amount of test code. And this method is more suitable for individuals familiar with most of the code to know how one component might affect another or at least is well-versed in the particular area being changed.

    The second method is more meticulous but takes up significantly more time especially if the PR is large.

    Even in the second method, without test code there will be no sure way to know if the changes broke anything just by manually testing, test code is still necessary to formally verify. In this case, if additional test code is written to verify the PR, we can also make use of the feature of GitHub that allows us to push directly to the branch of the PR and complement the PR (do inform the PR author though). IMO the time taken is actually worthwhile for especially for larger changes to the code base when more tests are written for it in the process. Some examples would include major refactoring or restructuring of the code.

    All in all, having relevant test code in place still feels like the key to approving PRs. Without them, I highly doubt it is any different from merging without any review unless the reviewer is an expert with special abilities to simulate the code. Not sure what others think.

    I think you made a good point about having relevant test codes which will prove that PRs that passed the CI checks are, at the very least, worth reviewing. In terms of reviewing PRs, I personally feel that if the changes are non-critical and easily verifiable(for example documentation updates), it is possible to go with the first approach after a cursory check. As for the second approach, it is more suitable when changes are dense and the points mentioned in the PR message are hard to confirm with mere eye power.

    That said, I think this brings out the importance of having a proper PR message that conveys the changes, the reasons behind them, and any note-worthy points. If such a message comes along with the PR, it will become a good checklist for PR reviewers to know what to expect.

    Hi, I found the following rationale for Optional by Stuart Marks (a Principal Member of Technical Staff in the Java Platform Group at Oracle) to be particularly insightful:

    Optional is intended to provide a limited mechanism for library method return types where there is a clear need to represent "no result", and where using null for that is overwhelmingly likely to cause errors.

    In general, the consensus is that we should avoid using Optional in fields, method parameters, and collections. In your example, perhaps a default empty Remark object could be used for the remark field.

    As prof likes to say, it's about the pros and cons. While null is generally considered a bad idea, it has its place in certain scenarios where there is simply no better alternatives.

    I think this is a great question and there's not much information in the textbook on the aspect of handling exceptions at which suitable level of abstraction. However, there is this statement from the textbook:

    Most languages allow code that encountered an "exceptional" situation to encapsulate details of the situation in an Exception object and throw/raise that object so that another piece of code can catch it and deal with it. This is especially useful when the code that encountered an unusual situation does not know how to deal with it.

    I believe in our program, we typically throw exceptions that are ultimately resolved at a higher level of abstraction. For example (AB3), the LogicManager has a method execute as follows:

    
    public CommandResult execute(String commandText) throws CommandException, ParseException {
    
            logger.info("----------------[USER COMMAND][" + commandText + "]");
    
    
    
            CommandResult commandResult;
    
            Command command = addressBookParser.parseCommand(commandText);
    
            commandResult = command.execute(model);
    
    
    
            try {
    
                storage.saveAddressBook(model.getAddressBook());
    
            } catch (IOException ioe) {
    
                throw new CommandException(FILE_OPS_ERROR_MESSAGE + ioe, ioe);
    
            }
    
    
    
            return commandResult;
    
        }
    
    

    There are two ways of handling exceptions displayed here. One is that it abstracted out a parseCommand method which throws ParseException. The execute method does not handle it but merely states that it throws ParseException, passing the work to yet another higher level of abstraction. In this case, it goes all the way up from LogicManager -> MainWindow -> CommandBox where the exception is handled as follows:

    
    /**
    
         * Handles the Enter button pressed event.
    
         */
    
        @FXML
    
        private void handleCommandEntered() {
    
            String commandText = commandTextField.getText();
    
            if (commandText.equals("")) {
    
                return;
    
            }
    
    
    
            try {
    
                commandExecutor.execute(commandText);
    
                commandTextField.setText("");
    
            } catch (CommandException | ParseException e) {
    
                setStyleToIndicateCommandFailure();
    
            }
    
        }
    
    

    This is a case where the author (I'm guessing here) believes that CommandBox is the right place (as in appropriate and justifiable) to resolve the two exceptions. Hence, the classes along the execution path could simply pass along the exception without dealing with it.

    If you look at LogicManager's execute method again, it resolves another type of exception: IOException. This is a case where the author (I'm guessing here) believes that it is the job of LogicManager to handle the exception created when saving data into storage.

    I believe that handling exceptions at the right level of abstraction is not an easy task.

    Let's see what Prof & others' insights are 👀

    Hi everyone, one of my application features is to allow the user to enter which residence the user stays at on campus. The input must be one of the allowed values, which I is what I did originally

    ori

    However, my teammate told me it is bad design to compare strings like that, and told me to use enums instead. So it is now like this

    residence

    I have read the discussion over at #14 and I would like to ask

    1. Is the use of enums even worthwhile here? Given that it adds much verbosity to the code. Maybe I could simply declare all the strings as static final?

    2. How best should I do it? Currently I use the Enum.valueof to convert input strings to enums. However, this throws an IllegalArgumentException which I need to catch and then throw another exception to display an error message if the input is incorrect. When I do this, I get an error which says incompatible thrown types ParseException in functional expression. Basically, functional expressions cannot throw a checked exception. The exception is caused by this

    isvalid

    Hope someone can help. Thanks!

    Hi all, below all the PRs I've seen so far are these CodeCov reports. I understand they are meant to tell the users about the test coverage, but I still have no idea how to use them. Could someone enlighten me? Let me give one example

    Hi all, I changed the @Override equals() method in Person.java, after adding several new fields to the class. The purpose was to update the equals() method so that it will account for the new fields when comparing instances. However, that also causes some of the existing tests to not work, and I really don't understand why.

    err

    The image here shows what happens. Line 150 is assertEquals(expectedModel, model);

    I ran in debug mode and I found that the fields of the Person instance were the same for both expectedModel and model.

    is same

    So I am really not sure why this is happening, especially since this didn't happen when I didn't update the equals() method, even after I had added the new fields.

    Appreciate any and all help. Thank you.

    (If you would like to soft wrap your .md and other files in the editor, refer to #188)

    If you're like me and you use IntelliJ for version control, you can ensure the text soft-wraps by going into Settings and checking the boxes as follows

    tip

    My question is because I feel that in my group at least, we are not limited to working on the logic, UI, storage, and whatever other terms that are being used. In other words, we are working on a bit of everything. Therefore it is difficult to categorize our responsibilities. So my question is, can we do away with it? Or if not, could someone suggest a better description? Maybe a list of the specific contributions made to the project?

    The same can be said for the roles, our team structure is an egoless democratic one. Could everybody simply be a 'developer' with no team lead further elaboration?

    Hope to hear your responses and suggestions. Thank you.

    Hi everyone, in the AB3 command "ADD", there is an optional parameter for the command called "TAGS", which is the last one in the command string. My group would also like to introduce an optional parameter in place of "TAGS", however, it is the second-last. There is a compulsory parameter behind this optional one. However I also recall seeing documentation of other libraries and languages where the optional parameter seems to be at the back as well. I would like to ask if there is such a rule regarding this issue?

    Hello, I have a question regarding the workflow. Is it a good idea for the team lead to merge his/her own PR? My understanding is that it is good practice to have other team members to review the PR before it is merged. What about the team lead's own PRs? In my group, every member has admin access, but we're not sure if we should merge our own PR. Hope to hear your thoughts

    Hi all, I was discussing this question with my teammates when planning the workflow for v1.1. There are some instances where it does not seem like a branch is necessary. One example is updating the "About Us" page, where each of us uploads a picture of ourselves and adds a few other links. Is it necessary to use a branch here? Can we do this on master? Is "branch clutter", i.e. having too many branches, a legit problem?

    (Issue with IntelliJ 2021.03.01)

    Hi, I'm going through the "Get Familiar with Code Base" part of week 6 for the AB3. I am facing an issue where I am unable to start the debugger for some reason. I never faced this issue in my IP. When I click 'debug' the UI opens as per normal, but nothing appears on the debug console. Could someone tell me why>

    tp debugger

    Hi everyone, I have a question about the IP grading since the deadline is next week. I have a few doubts, and I would like to clarify them now.

    1. Regarding the IP requirements: Correct me if I am wrong, but I believe what happens is that the grader(is it script or human?) will click on the tag associated with the particular requirement and grade that branch according to the requirement at that time. As long as the requirement is met, it counts towards the Implementation component.

    2. What if I implemented something imperfectly at that point in time, but made changes and corrected it much later? I know it is possible to move the tags, but I'm not sure if I should move a Level-2 tag, to, say, after Level-10.

    3. Will the overall submission be looked at, at all? Or rather, what is the role of the overall submission?

    EDIT: 4) Another question I have is, I only just realised that I have not been 100% following the git commit conventions. How will this impact my grading, since more than half of the commit messages are not exactly correct? Specifically, I added a full stop at the end of every commit message subject.

    EDIT: 5) One big nagging question is also regarding handling exceptions. Initially before the GUI was added, one could read the exceptions since the app and the exceptions were both shown in the command line. However now with the GUI, the user would not be able to see the error messages, which is a bit unsettling to me, although I am not aware of any requirement to implement this. Am I right to say that handling exceptions as it were is acceptable?

    I think I will have more, but these are the ones in my head at the moment. Thank you.

    Hi everyone, I'm starting on integrating the GUI with the Duke project, though I'm running into some trouble. The app crashes when I enter input, but that is not the problem. The problem is that I cannot see where the runtime error is, nor can I see the stack trace. It's not the terminal, where it usually is for CLI. Does anyone know how I can access the error list? Thank you

    • Your development environment (Intellij 2020.3, Java 11.0.9, Windows 10 64 bit, ...)

    Hi all, I'm doing the GUI tutorial and all is well until the last section of part 4, where I am unable to import the fxml packages.

    I'm wondering if gradle forgot to download that particular package? I don't think this is the case but I don't know what else to do either.

    You can see the problem in this screenshot

    I also have my dependencies in this screenshot

    Remember to give sufficient details e.g.,

    • Your development environment (IntelliJ March'20, Java 11, Windows 10, ...)

    • Relevant code, error message, stack trace

    • Relevant code snippet (an example given below), or link to the relevant code on your GitHub repo

    Hi, I tried running the checkstyle on the gradle and I am getting this issue, which I do not understand what it means. Could someone point me in the right direction? Thank you

    https://drive.google.com/file/d/1ND1cA3OVn5wHP17gsw8kMd_wnK2tSFwp/view?usp=sharing

    Hi everyone, I was just wondering how certain methods that return void can be tested(such as public static void main) since these methods do not return anything, hence there would be nothing to compare with. Please correct me if I am wrong, or offer some suggestions. Thank you

    • Your development environment (IntelliJ version, Java version, OS, ...)

    Intellij March '20 Community Edition, Java 11, Windows 10 64-bit

    • Relevant code, error message, stack trace

    'FC' is not recognized as an internal or external command,

    operable program or batch file.

    Hello everybody, I get the above error message when trying to run the script to test my program(between level 4 and level 5). I did not make any changes to the script as it appears to me that the location of the file is correct. I have attached a screenshot of my file structure as it appears in Intellij, in the link below. Any help is appreciated. Thank you.

    https://drive.google.com/file/d/11NM1nVkkfjoNYxjgtpEkgSGA0tPgw4h2/view?usp=sharing

    @SoonKeatNeo Thank you, I replaced the FC command with the full path and it worked. What should I do to rectify the environment variable issue? (The other day I had some trouble with my Java version and I might have messed it up accidentally)

    @damithc I'm using the terminal in Intellij. Now that I have managed to run the script, may I ask why the expected text is still the "Hello from Duke" instead of the chatbot response? I have attached a screenshot of my output below

    https://drive.google.com/file/d/1K4X8LvO5M_RGMw_-3ZsshfwYpiKTKoFZ/view?usp=sharing

    Thank you

    @danadi7 That solution didn't seem to work for me, I'm still getting FC is not a recognised command

    @tohyuting I managed to solve the issue in the end by adding the '%' around the path variables, after taking at a friend's setup. Not sure why this is the case, but if anyone faces this issue, just take note that they are needed

    The reason was because I did not have the suppressions.xml file in the checkstyle folder, which caused the issue

    Thank you for the response, this was an enlightening discussion 😃

    @damithc noted, didn't know that was possible! Post amended for clarity

    Resolved. The javafx block in the dependency was causing the issue. After I deleted it it worked fine.

    (I only added it because I was referring to some external tutorial on javafx, I suspect it could have conflicted with the other dependencies)

    This was very helpful! Can't find anywhere else on google

    Ensure you have put a breakpoint in the code and breakpoint is in a statement that will be executed during normal operations

    Sorry, forgot to do that. That solved my problem

    Thank you for your responses. I gather that it is highly highly recommended to work on branches instead of master.

    It is possible to delete a branch after you have merged the changes

    @damithc Can this be done for tp? I recall we were explicitly told not to delete the branches for ip, but it would be great if it were different

    @damithc Thank you for your reply. I have a much better idea now. The question then is: How are these roles allocated? It is not as though all of us already have a very deep knowledge of that area with rich experiences.

    This also leads to my original concern, how should they be represented in the AboutUs? I know the obvious answer is "Just list whatever you did" but the reality could possibly be more complex. People might disagree about contribution levels, for example, and insist that they take on a certain role/responsbility as well. Would it be possible in this case, for multiple roles/responsibilities to appear as shared?

    For some reason my teammate didn't face this issue, so I'll close this for now...

    @damithc thank you. Could you change the label back to a help request though? That was the second reason for this post.

    My question is:

    How best should I do it? Currently I use the Enum.valueof to convert input strings to enums. However, this throws an IllegalArgumentException which I need to catch and then throw another exception to display an error message if the input is incorrect. When I do this, I get an error which says incompatible thrown types ParseException in functional expression. Basically, functional expressions cannot throw a checked exception. The exception is caused by this method reference

    method reference

    I have tried to remove the method reference and explicitly pass the functional interface, however I ran into trouble with that as well. Now compiler complains that initialData might not be initialized. This is in the MainApp class

    try

    If someone could help it would be great!

    Above is when I name the file Find.java, everything works fine.

    But now when I changed it to camelcase naming, the java file recognization breaks.

    In case this helps:

    After doing some research, I tried changing the sources root but to no avail. Anyone knows what's up with this? Thanks in advance!!

    As you can see, the branch "tutorial-adding-command" is present on github but unavailable for me to push to from sourcetree. But I can see that branch in sourcetree on the left panel. Pls advice, thanks in advance!

    Hi guys why do I keep failing this when I made sure build is already successful? And I resolved all checkstyle errors.

    All the JUnit tests passed as well, I just can't seem to get past this error. Thanks in advance!

    Hello guys! Any of you have any idea how to solve: File does not end with a newline. [NewlineAtEndOfFile]

    This is another problem caused by the checkstyle. Since we are not allowed to configure the checkstyle.xml, how would you guys manage this?

    Hello friends! I have a problem 😦

    After implementing the checkstyle, there seems to be an import error for DukeException in my Duke.java, while import for all the other files works just fine. I can't do * because the checkstyle.xml issues an error for that. I checkstyled my DukeException.java and there's no error whatsoever. Any of ya knows what's the problem? Huge thanks!

    Duke.java:

    DukeException.java

    Dear Friends,

    Right after merging your branch to your master branch, did you get a notification "2" as seen on the push button on top. May I know why is that the case since I already pushed to my branch before merging with master.

    Apologies for the inconvenience. Thanks in advance!

    Hello friends. I'm sorry if this has been mentioned. But will we be penalized if we happen to skip this part if I don't see the need to use Enums?

    Alright thank you 😃

    I agree with Samuel. And your code will look much more readable when you implement switch case as you are determining the command eg. todo, deadline etc.

    This could also be helpful:

    https://se-education.org/guides/conventions/git.html

    It highlights some git naming conventions etc.

    I created a PR to merge to master, and my local copy seems to be the same as the remote copy. The "2" is still there though.

    I think you guys are right, I merged the branches to master remotely but not on my local copy. Which means I need to pull before pushing due to the commit difference, because I ticked create new commit every time. I think that's the rough idea.

    my bad! I solved it the moment I posted.

    For those wondering, literally just press "Enter" to add a new line at the last line of your file.

    Thank you! it worked

    @w2vgd I managed to get rid of the warnings by digging the checkstyle.xml and comment out the code block for MemberName (line 120). But I'm not sure if that's allowed.

    @damithc Are we allowed to comment out that part?

    Hi @candyhy yea I made sure those errors are all resolved.

    Is there by any chance this could be the problem?

    @damithc I don't think so. Their PR seems to pass the checks

    I tried copying a working copy of the run-checks.sh file from the remote repo to my local copy. Still failed the check.

    https://github.com/AY2021S2-CS2103T-T13-2/tp/runs/1998547056?check_suite_focus=true

    I replaced the entire config directory from a working repository. Still failing checks though..

    @damithc Nope. I did not intend to

    @damithc I guess those files are automatically changed to be compatible with linux? Im not sure

    @damithc I'm using Intellij. But I faced this problem of not being able to find remote branch "tutorial-adding-command" in sourcetree to push to so I used my WSL ubuntu terminal to push my changes.

    I think that's where the file changes problem originated?

    https://github.com/nus-cs2103-AY2021S2/forum/issues/193

    I realized what happened. I was tracking the wrong remote branch.

    Thank you prof @damithc and @candyhy, I think I solved it 😃

    @damithc Hi prof. No I tried cloning & clearing cache and restarting but none of that works. My TA also helped me but it still does not work. But overall it doesn't affect running tests and the program so I think its fine?

    
            dialogContainer = new VBox();
    
            scrollPane.setContent(dialogContainer);
    
            userInput = new TextField();
    
            sendButton = new Button("Send");
    
            AnchorPane mainLayout = new AnchorPane();
    
            mainLayout.getChildren().addAll(scrollPane, userInput, sendButton);
    
            scene = new Scene(mainLayout);
    
            stage.setScene(scene);
    
            stage.show();
    
            stage.setTitle("Kelbot");
    
            stage.setResizable(false);
    
            stage.setMinHeight(500.0);
    
            stage.setMinWidth(400.0);
    
    

    However, the title does not show up and the application is resizable, I'm not sure what I am doing wrong here...

    I have moved the code to Main file instead of my Duke file, so I guess any changes to the scene must be done there instead, but I wonder why that is the case

    When I run my code on IntelliJ, it is able to read and write data into the .txt file normally

    But when running it using .jar, it shows (The system cannot find the path specified) as error.

    P.S. My code for the file path is

    java.nio.file.Path path = java.nio.file.Paths.get("src", "main", "data", "Kelbot.txt");

    Also I am quite confused by the relative file paths, as the location of the jar file and the main file are different, wouldn't the relative file path be different too?

    Thanks in advance!

    While doing A-TextUiTesting, I come across this error

    Kelbot has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

    I am using IntelliJ Version 2020.3, Java Version 11 (at least I believe so as for some reason when I do java -version on my IntelliJ terminal it insists on being Java 8 despite me choosing the runtime to be 11 using the Choose Runtime plugin, adding Java 11 to my PATH environment and also ensuring that the Project Settings have it at Java 11)

    Due to this, the ACTUAL.txt is forever empty and thus cannot be compared with EXPECTED.txt

    Also, I am also unable to see my tags at https://github.com/zoeykobe/ip/tags, even though in my git bash if I do git tag it will show me all the tags

    Hello, thank you for your help!

    I have checked that the JDK location is correct, it is the exact same location as the one shown in your photo.

    As for the tags, is it normal that everytime i run git push, they ask for my username and password, and I have to key it in twice because of Logon failed, use ctrl+c to cancel basic credential prompt.?

    Hello! I do have more than 1 Java Version installed, Java 11.0.6, 11.0.5 and 8!

    Hmmm there is only one Java Path in my Environment Variable though!

    Ill try out the update part! Thank you!

    I believe that your current Java path in your environment variable is pointing to Java 8. Can you replace that path with your java 11 path (you can use the directory given in the where java command) and try to run your runtest.bat file again?

    I have done the where java and changed the PATH environment variable, it still has the same issue 😦

    Could it be that the file for Java exists, but not the installation?

    Hey @zoeykobe! See if the accepted answer (and its comments) in this thread helps. It seems to describe an issue very similar to yours! 😃

    I have seen that already!! Seems to be a different issue than mine. I decided to uninstall all my Java and reinstall only Java 11, it works now! Thank you everyone!

    @zoeykobe In future, try to limit each issue to one problem only. Trying to solve multiple unrelated issues in a single issue thread can cause confusion.

    I see, sorry for the confusion Prof!

    Might be a similar issue to this. See if the solutions there help 😄

    Hello! I don't really think it is similar as my Jar file still runs except it cannot detect the .txt file through that file path, but I am still able to use it ad hoc (without loading and saving)

    Might be a similar issue to this. See if the solutions there help 😄

    Hello! I don't really think it is similar as my Jar file still runs except it cannot detect the .txt file through that file path, but I am still able to use it ad hoc (without loading and saving)

    I believe the system is unable to find the path specified because the folders containing your .txt file is not present. If you go to where your jar file is sitting and create the folders as such ./src/main/data/ and run your jar file again, does it work?

    Ah, so recreate the exact same relative location to the jar file?

    Yup! If you created the folders manually and that solved your issue then you can look to implement the file creation in your code instead 😄

    Interestingly, when I run the jar file from IntelliJ, it works just fine. Might be an issue with my command prompt...

    Yikes, is it still the same error message and are you running java -jar within the same directory in both IntelliJ and on the shell? It might help to attach some screenshots or share the structure of your project currently as well 😃

    Yep same directory, I right clicked on the jar file and opened cmd prompt, as well as right clicked on the jar file and then clicked run.

    From the shell, can you check if there is a src folder in the same directory as where your Kelbot.jar is? If there is, check if there is a main folder within the src folder. Finally, check if there is a data folder within the main folder. If any of the three folders are not present, your code responsible for creating the folders is likely not working as intended.

    There isnt, but as the jar file is in out/artifacts/kelbot_jar/ directory, there shouldn't be a src or main or data folder right?

    Here is a screenshot in case I'm not very clear!

    So I just double checked and I have a data folder created at ./out/artifacts/ip_jar/data for my case where I stored my data file in ./data/tasks.json. I believe your code will need to ensure that ./src/main/data is created at where your jar file is sitting. Give it a try and see if that works 😄

    Edit: Consider adapting and playing around with the following:

    File file = new File("./data/tasks.json");

    file.getParentFile().mkdirs();

    I changed my path to be relative, with java.nio.file.Paths.get("..","..", "data", "Kelbot.txt");, as I suspected that since my jar file is not in src, the original path is not working there, however i got an access denied...

    I changed my path to be relative, with java.nio.file.Paths.get("..","..", "data", "Kelbot.txt");, as I suspected that since my jar file is not in src, the original path is not working there, however i got an access denied...

    The use of double .. will bring you two directories up to the out folder but I am unsure how this will help with your case 😅 Since you are getting an access denied error, try running the cmd prompt as an administrator. If this works, you can check your folder/file permissions 😃

    Ah so the relative path from the jar file should be the same as the relative path from the java file...

    I got my access denied from IntelliJ...

    I suggest working with a simple ./data/Kelbot.txt for now (which means a data folder at where your jar file is and the text file will be created within it). Access denied does sound like a separate problem which will require you to check read/write permissions but take it step by step and see if you are able to run the jar file as administrator from the cmd prompt first 😃

    The thing is the file is always created with respect to ip directory, not with respect to wherever the java file/jar file directory is.

    So when I do .. it actually went out of ip into the parent folder of ip, which is probably the main problem hahahaha

    I see, so use ./ such that it will create in the ip/data/Kelbot.txt, and when ran in jar file, it will create it in the same directory as jar file. So 2 different data/Kelbot in my ip?

    I see, I got it to work!! Thank you so much!!

    I think that checkstyle also insists on not having any whitespace lines while the Coding Standard says that in some cases separating the lines by logic is fine

    There doesn't seem to be anything problematic with this fragment of code, do you mind sharing other relevant parts of the file?

    It turns out that I had to apply the setters to the stage in the main.class instead of edit the Duke.class, so I got that figured out, but still confused as to why that is the case

    Is your stage.show() within your Main file instead of Duke?

    I followed the tutorial and there were both

    Correct me if I am wrong but I felt the tutorial used Main and Duke interchangeably a couple of times in the third tutorial. In one of the steps they said Main class but their example was showing that of Duke. For the fragment of code you showed in your first post, I believe you might get something if you add stage.show() right after stage.setScene(). If it is convenient and you would like to you can give it a try. Otherwise if the issue is already resolved that's great too 😄

    Hmm yea in the end I went and did that in Main.class and it worked, that's why I was confused as to why it didn't work in MainWindow

    According to the admin page, I think we are supposed to use JDK 11, which should correspond to Bytecode version 55.0 which is what I believe you're referencing to. Testers are also supposed to be running your jar file on JDK 11.

    According to https://se-education.org/guides/conventions/java/intermediate.html#types, it should be String[] eventArr = userInput[1].split(" /at ", 2);

    Rationale: The arrayness is a feature of the base type, not the variable. Java allows both forms however.

    Edit: include the rationale

    My take is that If an exception is thrown then the lack of a return statement should not matter. So I guess your problem at hand is with assertions. Since assertions are not meant to be recoverable and indicates a bug to be fixed, it should not be triggered at all if the code is correctly written. If it is expected to occur then an exception should have been thrown in order to be caught. Using assert false in default case or else blocks is equivalent to not using it since assertions can be disabled. So ideally your code should have a happy path that always returns something valid, assertions are there to help you catch unexpected bugs when assertions are enabled.

    The following is extracted from the link you have provided.

    Since:

    8.36

    Doing a quick check on build.gradle shows that the version of checkstyle we are using is 8.29, so that should explain the error you have encountered 😃

    For the oracle tutorial, they are using enums, which should only take on a limited number of values in which all of them should have a switch case, the only time that the assertion occurs is when a new enum value is added but not handled. This is a good scenario to use assertions since it indicates that the code needs to be updated. Furthermore, the switch case does not return, so presumably there will be a happy path below to handle the returning. For your example, you might want to explain the rationale behind asserting and catching that very same assertion when it can be handled all within the same else block. I would assume if the command is invalid, a parsing exception should either be raised like for the banana scenario since it is not to be handled by the parseCommand method, or there is a default Fruit to be returned instead.

    I took a brief look at your iP code, I assume that the relevant part of your code in in Parser.java, namely the Parser::parseRemainder right? Do correct me if I am wrong. My understanding of exceptions is that it is thrown when something out of the norm has occurred, and it is something that the current method that is throwing the exception should not be able to handle. Hence throwing an exception will skip the rest of the execution and raise it through the call stack for it to be caught. If the current method can handle the issue, then an exception should not be thrown, it can be handled directly at the place where the exception is thrown.

    I understood your point of not returning a default object since there's none for this case, so throwing an exception to be caught by the call stack makes a lot of sense, since an exception during parsing indicates no valid return value, and hence the method calling Parser::parseRemainder ideally should catch this exception and be able to handle it, i.e. printing the error message.

    (Exception throwing is quite literal, it's about throwing the problem to someone else, so I don't have to handle it)

    Yup you're right, since your if-else block is the only block left, and every block returns a valid object if no exceptions raised, it should not complain anymore.

    Your branch-A-Assertions share a common history as your master branch, differing only by the merge and undo commit, hence there is nothing to be merged into master. For this case, it is easier to just undo your last 2 commits and do a force push on your master branch. You might want to take reference from here.

    What is this "revert/CSmortal/branch-A-Assertions" branch? Is it just a local branch thats why I can't see it on my remote repo? What is its relationship with the local and remote "branch-A-Assertions"

    it is just a local branch named as "revert/CSmortal/branch-A-Assertions", before doing any reverts it is just a 1:1 copy of your master branch, after the revert commit if you didn't also push the local branch but only merged the revert branch, you won't be able to see the branch on the remote.

    There shouldn't be a need to run the program using sudo, based on the error message, it is likely that your DISPLAY environmental variable has been configured wrongly somehow in your setup. By running echo $DISPLAY should tell you what the current value is. To override it temporarily, try something like DISPLAY=:0 java -jar duke.jar, change the :0 to something other than the current value. It might help to compare this same variable with your friend's setup, e.g. mine is :1.

    Assuming that you have enabled Github Actions on your team repo, from the image above you can see that after selecting the "Java CI", the right submenu has an option to create the status badge, in the pop up will be the markdown formatted link of the badge that you can copy and paste into the README.md in your team repo.

    @tlylt if the parent class does not have a parameter-less constructor, it means that the default call to one will fail to match any constructors, but it is not quite possible to deduce what arguments are to be passed to the parent class constructor, hence an explicit call is necessary in this case. The parent class constructor has to be called in one way or another, be it implicit or explicit, or else the parent class data members and virtual method table cannot be initialised.

    I've cloned your repo and tested it myself, the tests do run except that they are failing. Perhaps you can delete the .idea directory and import the project again to see if intellij corrects everything.

    I'm not sure why it's failing on yours

    If it helps I'm on your master branch 918128baee8c7e5933dd1ee7e683bc3f3fe3ec6d, perhaps you have commits not yet pushed to remote or you're on another branch?

    However after I did this, I can only run my jar file by 'gradlew run' and not when I right click "run" on my Launcher class...

    I did manage to run it both ways, perhaps the intellij run configuration is still wrong? A simple way to find out is to push all changes to github, clone into another directory and import into intellij again.

    I think this post sums things up pretty well in terms of reusing branches. Reusing branches introduces needless complications that git intends to solve by make branching cheap and simple.

    Following advice from here, and since we are recommended to use the issue tracker to manage task delegation as well, it feels much simpler to name a branch along the lines of 50-update-userguide-add-command, where 50 is the issue number.

    Thanks for the tip, however, I'm a little confused, is this directed towards a workflow other than the forking workflow? Because if we were to follow the forking workflow and make use of PRs, it is unlikely that we merge any PR outside of the web interface. Though I do see a use for this if the team is not using PRs and creates feature branches directly on the team repo instead.

    From my point of view, I don't see much value in the merge commit when merging upstream to one's fork, given that this merge commit does not serve much purpose since we do not touch the master branch on both the team repo and our own fork, the two master branches should ideally be identical. It is unlikely that one will want to undo the merge from upstream to their own fork. For the case of undoing a merged PR, my understanding is that the merge commit for the PR is already sufficient to perform git revert.

    As for branches themselves, my preference is to always rebase onto the latest master instead of merging master into the feature branch. The advantage of rebasing the feature branch is that it avoids the numerous merge commits that is rather meaningless and clutters the commit history instead, also that means keeping up with the latest master frequently while working on a big feature is possible and help show conflicts earlier. A linear history might prove to be useful down the line when trying to identify bugs using tools like git bisect. Of course even with that said, rebasing should be avoided once the feature is submitted for PR review.

    Just my 2 cents on this matter, do correct me if any of my understanding is wrong.

    Edit: Found this article that sums things up pretty well.

    I think the more suitable solution for this solution is git switch branch-name, which will automatically track the remote branch. git switch is a relatively new command that in general offloads the branching related tasks of git checkout and makes things less confusing while also being more intuitive sounding.

    You might want to try File > Invalidate cache and restart.  ---- On Tue, 16 Mar 2021 11:04:22 +0800 @.*** wrote ---- Previously re-cloned my own tp project, but after that I encountered these problems. The import statements are appearing red and so are the classes in the code as well as their respective methods, even though they exist. I keep getting the 'Cannot resolve symbol 'xx'' error. Would appreciate any help, thank you in advance!

    —You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe.

    The first method is obviously faster but prone to bugs since if no checks are done in the application itself, we might not know if someone's change broke anything.

    I feel that this point would largely go away with sufficient amount of test code. Since CI has been setup, we should have a decent amount of confidence that if it passes, that should imply that there are no breaking changes unless the PR disabled some test code or broke the test code itself, which is quite evident when looking at the code. Of course all these are on the assumption that there exists sufficiently good amount of test code. And this method is more suitable for individuals familiar with most of the code to know how one component might affect another or at least is well-versed in the particular area being changed.

    The second method is more meticulous but takes up significantly more time especially if the PR is large.

    Even in the second method, without test code there will be no sure way to know if the changes broke anything just by manually testing, test code is still necessary to formally verify. In this case, if additional test code is written to verify the PR, we can also make use of the feature of GitHub that allows us to push directly to the branch of the PR and complement the PR (do inform the PR author though). IMO the time taken is actually worthwhile for especially for larger changes to the code base when more tests are written for it in the process. Some examples would include major refactoring or restructuring of the code.

    All in all, having relevant test code in place still feels like the key to approving PRs. Without them, I highly doubt it is any different from merging without any review unless the reviewer is an expert with special abilities to simulate the code. Not sure what others think.

    Not sure if immediately rethrowing Exceptions is a good practice.

    To quote from the textbook

    The exception handler chosen is said to catch the exception.

    Since exceptions can automatically propagate through the call stack, any method catching it should be in charge of handling it instead of throwing it again. In a similar fashion to the example @tlylt mentioned, the refactoring should be as follows:

    
    public void method() throws SomeException {
    
        handleBadOutcome(isBadOutcome);
    
        ...
    
    }
    
    
    
    private void handleBadOutcome(boolean isBadOutcome) throws SomeException {
    
        // some attempts to recover before throwing exception, sets isBadOutcome to false if resolved
    
        if (isBadOutcome) {
    
            throw new SomeException();
    
        }
    
    }
    
    

    While using SLAP for this scenario, handleBadOutcome is more of a helper function of sorts to achieve SLAP and not exactly an abstraction in the sense of having different responsibility. In this case I believe we can just view both method like they are at the same level of abstraction and not see the original method as a higher level that should catch it.

    The way git works is not simply to see the difference between the heads of the different branches to be merged, to put it in a simplified way, it will find the commits on the feature branch you're trying to merge that isn't available on the v1.3 branch of your team repo. The difference in commits and use those difference to generate the list of files that has changed. In this case, upon the first merge of PR no. 174, all the commits on your feature branch are now a part of the team repo's v1.3 branch. By performing a git revert, it does not actually remove those commits, it creates a set of changes that negates the changes introduced by the merging of PR no. 174. It is done this way to preserve history and forward-moving, thus there is no rewrite of public history.

    Back to the question as to why you can't create a PR on the same feature branch, it is because there's no commits on the feature branch that isn't on the v1.3 branch of your team repo. To be able to reintroduce those changes, you need to revert the revert. Yes it sounds confusing but you need to create a PR that reverts PR no. 175 instead.

    Edit: Just realised your team has a different workflow that merges to a separate v1.3 branch instead of master, be sure to protect that branch too to prevent accidental mergers.

    An automatic git revert cannot be perform because of merge conflicts due to the newer commits. In this case, you can just branch from v1.3 and perform the git revert locally and resolve the merge conflicts to complete the revert. I'm not familiar with sourcetree so I can only provide you with the command to perform the revert: git revert 3076a606, in the case that you aren't familiar with using git via CLI, there's hints after entering the above command on what you should do to complete the revert.

    Hi, I downloaded a copy of your program from your add-tests branch and ran the tests locally using gradlew test. Got a few failing test cases as shown in the screenshot above. Can you double check to make sure the test cases run locally?

    Same I could reproduce the same errors. You might want to run ./gradlew clean for a rebuild before running the tests again to see if it helps. Below are the detailed errors.

    
    LogicManagerTest > execute_invalidCommandFormat_throwsParseException() FAILED
    
        org.opentest4j.AssertionFailedError at LogicManagerTest.java:143
    
            Caused by: seedu.booking.logic.commands.exceptions.CommandException at LogicManagerTest.java:143
    
    
    
    LogicManagerTest > execute_validCommand_success() FAILED
    
        java.lang.IllegalArgumentException at LogicManagerTest.java:103
    
    
    
    LogicManagerTest > execute_storageThrowsIoException_throwsCommandException() FAILED
    
        org.opentest4j.AssertionFailedError at LogicManagerTest.java:143
    
            Caused by: java.lang.IllegalArgumentException at LogicManagerTest.java:143
    
    
    
    LogicManagerTest > execute_commandExecutionError_throwsCommandException() FAILED
    
        org.opentest4j.AssertionFailedError at LogicManagerTest.java:143
    
    

    So if I have a method abc and xyz, and abc returns a boolean based on a condition that xyz ALSO relies on, and for example this is how my code looks like

    
    if (abc()) {
    
          return xyz();
    
    }
    
    

    should xyz check for the condition (and also error handle EXACTLY the same as abc, if the condition check fails) as well to "decouple" these two methods, or should I instead "couple" these two methods by throwing an AssertionError in the body of xyz if xyz fails the condition check?

    If the former is preferred, there might be noticeable code duplication as well

    Background:

    I finished doing my parallel branches "branch-A-Assertions" and "branch-A-CodeQuality" for Wk 5 iP. Then I created a PR for ONLY

    "branch-A-Assertions" (my mistake), then merged the PR with the repo. Here is where I realised my mistake, so I followed this post and did these steps to reverse the merge PR.

    
    git fetch origin
    
    git checkout origin/master -b revert/CSmortal/branch-A-Assertions
    
    git revert -m 1 61720c8e5aa82d127e8eb6ee17e636e7e515d6b7
    
    

    It's my first time using git fetch, so I'm not sure if git fetch origin did anything cuz there was no output when the command finished. After doing git revert -m 1 61720c8e5aa82d127e8eb6ee17e636e7e515d6b7, there were many unstaged files (not sure if this the expected behaviour), then I committed them with the commit message "revert merge pull request".

    Problem:

    So now I'm trying to create another PR from my remote's "branch-A-Assertions" to "master", but I get the issue mentioned in the title:

    After some toying around, my guess is that this local branch called "revert/CSmortal/branch-A-Assertions" is in someway equals (i'm not sure) to the remote branch "branch-A-Assertions", which explains the picture above. My question is ...

    1. What is this "revert/CSmortal/branch-A-Assertions" branch? Is it just a local branch thats why I can't see it on my remote repo? What is its relationship with the local and remote "branch-A-Assertions"

    2. What do I do now to create a PR from "branch-A-Assertions" to "master"?

    This is how it looks like on my SourceTree right now, if you do need them:

    Sorry I can't put the link to my PR to the upstream repo here, not sure how

    So after learning more on code quality/standards, I was convinced that the default case for switch statements and else clause for if else blocks should almost always be exclusively for throwing exceptions or assert false/ throw new AssertionError() statements. But this doesn't get around the issue of having to return something from a non-void method. Returning null has always been my go-to until now for convenience sake, so I'm not sure what to do now.

    Asking since I don't think I'm exploiting the staging area enough. I don't want to inundate my repo with tons of commits, but git stash reverts my working directory back to the latest commit. So if I stage a small successful change in my project, is it possible to revert my working directory back to this staged change, if my current working directory has undesired changes ( after the successful staged change ) I no longer want? I apologise for asking here, but I thought asking on the forum was faster since it may quickly direct me to the right place to research further

    I'm following the guide step by step on how to set it up, but when i come to the part where it says

    I realise theres no checkstyle.xml file in my project. I installed the plugin, restarted intellij, don't understand what's going wrong.

    Nothing is going well for me in this mod haha

    I was following the Scenario 2 of "Adding Gradle to the project" in the Gradle tutorial. Because one of my test classes uses @ParameterizedTest, it now doesn't work after the gradle stuff was added to the project, and I figured that it was because the dependencies section in build.gradle didn't "import" the relevant junit class (package? Idk what to call it). How do I import it?

    The JUnit installed in my "test" module has version 5.4, so I'm unsure of why its not working.

    This is the structure.

    I copied and pasted both iml files into mine, still getting the same error.

    @tjtanjin I tried restructuring the proj the way you mentioned.

    I assume this pic below confirms that "java" under src/main is the source root.

    Strangely under the same "Project Structure>Project Settings>Modules" window, "java" under src/test is not marked as test sources root, when I have already done so on the left pane of intellij to mark it as the test sources root, and appears green as well.

    Under the same window, i tried setting "java" under src/test as the test sources root and i get this issue when applying changes.

    And lastly, the imports are all messed up and idk how to solve it. In Deadline.java, it doesn't know what Task is (like IntelliJ doesnt give me the option to import Task but they belong to the same package anw so why is this happening?), and ParserTest.java under test.java.duke has no option to import the classes in main.java.duke

    @tjtanjin changing my package statements for all my java files to package duke; still doesn't allow me to import the relevant classes within the same package.

    I just wanna check if I'm marking each directory correctly:

    Does this window confirm that the java folder within the main folder is the source root?

    The left pane on IntelliJ isn't very helpful cuz it just shows the whole thing main.java.duke without allowing me to right click on java to check what it is marked as. So i just resorted to the Project Structure window that comes up after pressing Ctrl + Alt + Shift + S above

    Also, I'm kinda confused why both src/test and src/test/java are both test sources roots, after i followed @ypinhsuan instructions. Is this intended? I'm reading up on what modules in IntelliJ are but im rly confused on what they are.

    Hi! As what @tjtanjin suggested, you can try unmarking all the directories and go to File > New > Module from Existing Sources. Select src\main. Mark src\main\java as sources root and follow the guide on adding JUnit test.

    I forgot to mention that I've never seen in the project's instructions that we are supposed to create a new module from src/main. I tried to do that and mark src/main/java as sources root, and i get this issue when applying changes:

    Sorry for asking too many questions but I rly don't understand whats going on with the modules and all

    Thanks @w2vgd for the 1st tip.

    This is my test.iml:

    This is my main.iml:

    I deleted a module called "ip" that i had previously since there seems to be some conflict with the "main" module (that i showed above but i can't rly understand).

    This is the project structure:

    Before i go on, i have another ( noob ) question to ask. How do I resolve this issue of having to put the main.java.duke. in front of every declaration of a class from our java files?

    Ah shucks, i forgot that i need to change the package statement for ALL of the java files.

    I no longer have the "No Tests were found" error!. It seems like the issue was with the coexistence of the ip and main module, where i believe my test module had ip as its dependency, which caused issues with making src/main/java the source root.

    @w2vgd I created the main module after the ip module, and then i later deleted the ip module.

    Cn I ask why exactly if the content root (im assuming this is just the root of a module) of ip is src, and if I had no main module, then why does the error occur (where the test module has ip module as its dependency)?

    @tjtanjin I tried adding testCompile("org.junit.jupiter:junit-jupiter-params:5.7.0") to the dependencies section of the build.gradle. Not sure what I had to do next so I went to the relevant java file and tried to see if the tag @ParameterizedTest is recognised, still doesnt work. So what i did next was to click the "run" button next to the dependencies section cuz i thought some downloading or something was required. Still didnt work after that.

    @tjtanjin Thanks, reloading project solves the issue.

    @richardcom Rebuilding also worked too, thanks! I also wanna ask if i wanna add more dependencies but the code is still not yet fixed/ready for building, is there a better way than having to reload(restart) the project every time i add a single dependency?

    @jasaaanlim thanks, I was under the impression that it automatically comes with installing all the stuff mentioned in the tutorial. I thought manually creating the checkstyle file from copying and pasting from github was the "primitive"/unrecommended way, guess I was wrong

    @chewterence

    for your 1st method that throws CommandNotFoundException, what if i didnt want the method to throw any exception, like if i wanted to handle any exceptions in this method, i.e.

    
    public Fruit parseCommand(String command) {
    
        try {
    
            switch (command) {
    
            case "apple":
    
                return new Apple();
    
            case "banana":
    
                return new Banana();
    
            default:
    
                throw new CommandNotFoundException();
    
            }
    
        } catch (Exception ex) {
    
            // Do something
    
        }
    
    }  
    
    

    I think this will have compile errors since the "missing return statement" error appears. I'm more certain this appears for if/else blocks instead of switch statement.

    As an example of the issue in my code, the situation looks something like this:

    
    public Fruit parseCommand(String command) {
    
        try {
    
            if (command == "apple") {
    
                return new Apple();
    
            } else if (command == "banana") {
    
                throw new Exception("what is a banana?");
    
            } else {
    
                assert false : "You shouldn't reach this block";
    
            }
    
        } catch (Exception ex) {
    
            // Do something
    
        }
    
        
    
        return null;
    
    }
    
    

    In the code above, I'm assuming the command can only be "apple" or "banana", so I'm trying to test that assumption with this code here. One else if block doesn't have a return statement, but even if it does, i still get the issue of "missing return statement" if i dont include the return null after the try catch block. And for the reason why i put the assert false statement in the else block, following this assertions tutorial in Wk5 topics, in the Suits example with the part on "Internal Invariants", it says we should test the assumption that the suit variable is one of the four types, so thus we should put a assert false statement in the default case of switch statement (and by extension the else block for if else blocks). So, regarding what @kouyk said about assertions "should not be triggered at all if the code is correctly written", I don't think his way should be the approach to writing assertions. Following the link, we should be testing assumptions, not riding on them.

    agree with @w2vgd that it is too hasty to conclude default cases and else clause should be used solely for throwing exceptions/errors. Printing in the default case can help debugging(to affirm that the switch clause is reached) since there can be new cases as we add new features to a software.

    Personally, I have used switch clauses in non-void methods, and I find no issue in the return statements as the default clause is never reached. Maybe you can consider handling all cases in the switch clause so the default case will never be reached? Variables can be declared as Integer count; instead of Integer count = null;

    Hope this helps! maybe you can consider showing us your code for more concrete help:)

    @candyhy I'm not very familiar with throwing and switch statements, but if you're enumerating all your cases ( not using the default case as your last case to handle the last possible input to the switch statement ), unless your method that contains the switch statement explicitly throws something in its method declaration, your default case should cause the "missing return statement" if it does not have a return statement. Please correct me if I'm wrong

    For the oracle tutorial, they are using enums, which should only take on a limited number of values in which all of them should have a switch case, the only time that the assertion occurs is when a new enum value is added but not handled. This is a good scenario to use assertions since it indicates that the code needs to be updated. Furthermore, the switch case does not return, so presumably there will be a happy path below to handle the returning. For your example, you might want to explain the rationale behind asserting and catching that very same assertion when it can be handled all within the same else block. I would assume if the command is invalid, a parsing exception should either be raised like for the banana scenario since it is not to be handled by the parseCommand method, or there is a default Fruit to be returned instead.

    @kouyk Ok so assuming its not enums, and each case in the switch statement returns something, then the solution to escape the "missing return statement" should be a happy path, or a default "Fruit" returned in the case of the parseCommand() method? Because the relevant code in my iP doesn't have a happy path (its checking what the input is "==" to, not checking against some boolean condition or smth), and i dont want to return a default object.

    I took a brief look at your iP code, I assume that the relevant part of your code in in Parser.java, namely the Parser::parseRemainder right? Do correct me if I am wrong.

    @kouyk yup, thats the code I'm having the issue with. So after reading Prof @damithc 's comment, for Parser::parseRemainder(), should I be including a throws Exception in its method signature, then remove the try catch block in the method, then I will no longer have the "missing return statement" error if i exclude the return null?

    thanks all, can I also ask when should I use assert statements over throwing AssertionError()? The oracle docs shows AssertionError would be better for those Internal Invariants situations and for the same issue of "missing return statement" error inside a non void method. Coupled with java disabling assertions by default, I can't see when to use simple assert statements.

    I'm done with that but I'm still kinda confused on the instructions.

    I don't seem to be able to follow it. My PR from "branch-A-CodeQuality" to "master" is unable to merge due to conflicts. So do I:

    1. Merge my local "master" into local "branch-A-CodeQuality" and resolve merge conflicts

    2. Merge the PR

    3. Pull from fork to my local "master" (and leave out "branch-A-Assertions"?)

    Is that all? I don't seem to be following the instructions at all from the pic.

    I added in the tp such that deletion of tasks can be done in 1 command, i.e something like delete 1 2 3

    This is how the parseCommand method in the class that my group has renamed from AddressBookParser looks like

    This is the Parser for the new command DeleteMultipleCommand

    This is the hasMultipleValidIndex method that was in the if clause of the very first picture

    This is the parseMultipleIndex method that would be called in the parse method of DeleteMultipleCommandParser, if hasMultipleValidIndex() is true (see the first pic)

    I wrote the code as such, because i didn't want parseMultipleIndex to depend heavily on hasMultipleValidIndex. But after looking at it again, I thought if it would be better to throw an AssertionError in both of the 2 condition checks in parseMultipleIndex, since it was checked for previously in hasMultipleValidIndex. But then I thought it might not be such a good idea since it "couples" these two methods together strongly.

    My question is which approach is better for code quality? (Not sure if thats the term to use either)

    As per title; for local storage files (a .json file for example), if we want to make some assumptions to certain fields (i.e. certain format of data), then do we need to account for 'illegal' user modification to the files? More specifically:

    • If we want to make the application fail if the modification to the data file is a corrupted one, then what can be considered as 'failing elegantly'?

      • The application cannot launch (gives error message when launching from CLI)

      • The application launches, but without corrupted data loaded

    • Do we need to explain it (how an advanced user should modify the data file, if he/she wants to) in our UG(/DG)?

    For tp:

    Hi! When Im running gradle::Tasks/verification/jacocoTestReport and it is saying something like Can't add different class with same name: seedu/address/ui/PersonCard with no further information.

    I got this issue because when I try to run the test cases, at the end it shows me something like this:

    
    2: Task failed with an exception.
    
    -----------
    
    * What went wrong:
    
    Execution failed for task ':jacocoTestReport'.
    
    

    This error seems a bit strange to me hmmm, anyone seen anything similar?

    Hi, was trying to do the tutorial (removing a field) for tp code base, just observed sth:

    when I do the refactoring (removing the phone field of Person), the tutorial mentions it is better to refactor the test data as well so that the old version does not accumulate.

    That part I have no problem with. But then I wonder whether we also need to refactor the json data under [root]/data/. According the .gitignore, that data file is not version controlled, which means if I delete the phone fields in the data file, then I switch to other branches, I would have issues loading data because some compulsory data field is missing.

    Then, does it mean I should not edit that data file when refactoring? I understand in this case if I do not edit the data file the code would work for my working branches and other branches, but are there any possible implications (which will make refactoring the un-version-controlled data file necessary)?

    If there are no such implications, it is clear that I should not refactor the un-version-controlled data file whenever I refactor my code. But I cannot get my logic correct here (either prove or give counter examples). Help needed. 😃

    E.g. For the A-UserGuide of ip tasks this week, I want to take the design idea from the AddressBook3 user guide, but it seems like the markdown language does not support commenting without displaying.

    Anyone got suggestions for how I can possibly give credit to the design idea of others in a markdown file? 😃)

    Hi prof @damithc, regarding week 6's luminus quiz, will there be a slight delay of 'finish early' criteria? The admin info says its within 3 days after the the lecture date but I would say that's a bit tough?, provided last week was CNY and the lecture was actually released ealier than usual.

    Thanks!

    When I wrote documentations for the Todo item, whenever I mentioned "todo" in documentation intelliJ will automatically mark it (and the text following it) as a TODO comment, which makes my documentation looks quite messy (through intelliJ).

    Just sharing it in case you have same feeling as me:

    Go to Setting/Preferences (for MacOS) -> Editor -> Color Scheme -> General -> Code -> TODO defaults -> disable the Error stripe mark, and disable foreground if it has a colored predefined.

    Rather trivial but it saved OCD like me 😂

    As per above. Thanks! 😃

    e.g.

    
    public class Dummy {
    
        public static final String DESCRIPTION = "This is a dummy class.";
    
    }
    
    

    Should we unit test such fields? Such testing seems to be tedious and a bit ... meaningless?

    If yes, what are the best practices?

    Thanks!

    Agree with @w2vgd. I used enum for the commands to facilitate printing out a help menu for commands available (just for fun).

    However, for the actual functionality side I haven't figured out a very elegant way to integrate enum with commands. Any suggestions?

    If you only added commits and did not push your commits to your remote repo, there will be no remote changes and your master branch will not follow you.

    I have yet to construct unit test for such fields and I do agree it seems quite meaningless xD However, should there be a situation where there is a need to ensure the description is correct, I would likely construct a test case as below within the DummyTest class:

    @Test

    void checkDescription_whenInputDescription_thenDescriptionMatch() {

    String expected = "This is a dummy class.";
    
    Dummy dummy = new Dummy();
    
    assertEquals(expected, dummy.DESCRIPTION);
    

    }

    Agreed. If I am not wrong you are saying there would be cases where there is a need to check whether the description matches the expected value, in this case, the String "This is a dummy class.".

    Just want to extend the discussion a little bit: normally we would have a lot of such static final field declarations in our application, then managing the 'expectations' would be quite troublesome already. I guess there would be some place/some way for us to manage what would be expected for the (important) static fields easily (e.g. instead of peeking at individual classes), but I have no clue : |. Anyone knows anything about it?

    I agree it's going to be huge hassle with lots of static final field declarations. Off the top of my head, I imagine for larger applications with lots of static final field declarations of string types, these strings may be stored/read from inside a messages.yml or messages.json file of sorts (has the added benefit of easy configuration/changing messages without directly editing the file containing code). It might then be possible to construct a single test class pertaining to all these messages which should at least centralise the testing and makes things slightly more organised. What do you think?

    I used to think of putting important static messages in a doc or something equivelent. But yeah, using a .json or .yml file as a whole seems to be a much better idea. 😄

    Thanks prof. 👍🏻

    Thanks prof 😃

    I was facing the same issue. Thanks for the suggestion!

    @damithc Just wonder how can we possibly give credit to it if we want to reuse this piece of code?

    @Cheng20010201 You can mention the original author and point to this post as per https://nus-cs2103-ay2021s2.github.io/website/admin/appendixB-policies.html#giving-credit-for-reused-work

    I mean like, I can just put comments in the fxml file in the same format as we do in java source code right? (except that the way of commeting is different)

    I was facing similar issues after I modified the original README.md file. I got it corrected by fixing no-new-line-at-end-of-file issue as well as trailing-whitespace issues. These are specified as shell scripts in [root]/.github of the tp folder.

    Markdown files can contain HTML comments e.g,,

    >!-- this

    is a comment -->

    Thanks. Didn't notice that. mb 😃

    For styling issues I would say no big difference. For performance issues mentioned above I would say streams can work parallel and can be more efficient compared to for-loop for a very big list of data. (But for small amount of data, yes, loop is usually more efficient.)

    The data in the data/addressbook.json is populated by the sample data utility if it is not present, so I think if your working data is messed up later you could let it re-populate again later.

    This one I didn't notice. Thanks.

    Does the same happen when GitHub runs the CI?

    No, the CI on github works fine. 🤔

    Hi @Cheng20010201

    I'm from your senior batch (dropping by in this forum to see if I can help you guys with tech problems).

    Maybe you can take a look inside your build folder to see if there are duplicate java class files.

    Remove the duplicate class files and see if it still runs

    The source below seems to have a similar issue as you.

    Source

    This one helps! I found on the pc I'm working on there are indeed duplicate java class files (dk why). I moved to another pc and everything is fine. I suppose it was some issues for me locally. Thanks for the help!

    Everytime I gradle run, I get these log files. What is triggering these logs? Is it because of config.json

    I received this error.

    An automated smoke testing of your iP JAR file found the application crashes with the following error(s) upon launching:

    On Windows, using Java 11, for the Percy.jar uploaded on 02-12-2021 (MM-DD-YYYY) at 13:57:31:

    Error: LinkageError occurred while loading main class Launcher java.lang.UnsupportedClassVersionError: Launcher has been compiled by a more recent version of the Java Runtime (class file version 59.0), this version of the Java Runtime only recognizes class file versions up to 55.0

    I received this for both Linux and Mac versions.

    I think this problem comes from compiling the program using java 14 instead of java 11.

    I set the default java version on my computer to java 11.0.9 and ran the build again with reference to #158.

    Is there a way to check the runtime of your jar file to make sure it adheres to the right versions.

    In my Main.java, I am trying to set an icon

    
    public class Main extends Application {
    
        private Percy percy = new Percy();
    
        @Override
    
        public void start(Stage stage) {
    
            try {
    
                stage.getIcons().add(new Image(getClass().getResourceAsStream("/images/percy.png")));
    
                stage.setTitle("Percy");
    
           } catch (IOException e) {
    
                e.printStackTrace();
    
            }
    
        }
    
    }
    
    

    However, no icon is showing.

    This is how my directory is organised

    How exactly does getResourceAsStream work?

    It seems that my messages are not rendering properly as I type more and more commands.

    I start by typing "list" and the output is fine.

    I type "list" the second time and the previous and current output is shortened.

    I type "list" the third time and current and prior messages are further shortened.

    I am using the view fxml given in the javaFx tutorial. Is this something to do with the scrolling?

    I am using the following command to generate my jar file.

    
    gradle clean shadowJar 
    
    

    When my project SDK is configured to java 11, I get this error when running the jar file.

    
    Error: LinkageError occurred while loading main class Duke
    
    	java.lang.UnsupportedClassVersionError: Duke has been compiled by a more recent version of the Java Runtime (class file version 59.0), this version of the Java Runtime only recognizes class file versions up to 55.0
    
    

    When I configure it to jdk15, the error stops.

    This project is required to be in java 11. How do I get around this.

    I am trying to test my Parser. This is how my Parser works.

    This is the constructor, taking in the full command.

    
    public Parser(String fullCmd) {
    
       ... 
    
        }
    
    

    This is my getCommand() method, that returns a command object.

    
        public Command getCommand() throws DukeException {
    
            ...
    
            case ByeCommand.COMMAND:
    
                return new ByeCommand();
    
            default:
    
                return new UnknownCommand();
    
            }
    
        }
    
    

    I'm testing it as follows...

    
    public class ParserTest {
    
        @Test
    
        public void testCommandGetter_byeCommand() throws PercyException {
    
            // assertEquals(ByeCommand(), new Parser("bye").getCommand());
    
        }
    
    }
    
    

    But I'm failing the test likely because they are not the same object.

    Any suggestions of a way of testing such input/outputs that are object related?

    The one covered in lecture tests for strings.

    I'm trying to use checkstyles from gradle, But I keep getting an error

    I got my xml files from https://github.com/se-edu/addressbook-level3/blob/master/config/checkstyle/checkstyle.xml

    I put the files in the directory as follow :

    This is how I setup the build.gradle: (is there anything wrong)

    @tjtanjin I'm getting the same error you got before. How did you solve the NoSuchElementException? This is my way of getting input. I have a Scanner called 'in' as a variable of this class.

    
       public static String readCommand() {
    
            String command = "";
    
            while(command.trim().isEmpty()) {
    
                command = in.nextLine();
    
            }
    
            return command;
    
        }
    
    

    Could you clarify what you mean by :

    "I had used a while true loop instead of checking for nextLine in the scanner to take inputs thus far."

    Thank you @lirc572 and @tjtanjin appreciate your help.

    hi @ypinhsuan I added mavenCentral() as you mentioned.

    I get this where I can see the checkstyle errors in a html file. Is this how checkstyle works?

    Running the following command

    
    gradle checkstyleMain checkstyleTest
    
    

    gives me the checkstyle listed in the terminal which seems to make more sense.

    Thank you. @tjtanjin @ypinhsuan

    Someone on this forum seems to discourage overriding.

    https://stackoverflow.com/questions/27605714/test-two-instances-of-object-are-equal-junit

    But for now I'll do it. Thanks for you suggestion @rajobasu

    Yes hahaha... Just exploring the options here. thanks guys appreciate it @georgepwhuang @rajobasu.

    Thank you

    Ok thank you.

    It works only when the Title is set before the Icon is.

    Try this without having to uninstall other versions of java

    https://stackoverflow.com/questions/21964709/how-to-set-or-change-the-default-java-jdk-version-on-os-x

    See markhellewell 's solution, it worked for me.

    Ok thank you.

    Interesting! thanks.

    Library

    TestFX

    Purpose

    Automated testing of GUI

    License

    EUPL

    I used enums for the commands as well, but also had to do some manipulation to get the enum constant. I converted the input string to uppercase and used the Enum.valueOf() method to get the corresponding enum constant, catching the IllegalArgumentException that is thrown if the command is not valid. This had the added advantage of allowing the commands to be case insensitive.

    This might help! You can change the import layout in intelliJ to match the checkstyle one.

    https://se-education.org/guides/tutorials/intellijCodeStyle.html#tweak-import-order

    In my opinion, I think it is fine to have a commit message with the same name as long as what the change is and why the change was made is clear. For example, a message such as "Fix typo in user guide" makes it very clear that we are fixing a typo because there was a mistake.

    However, I feel that "Update Automated UI Testing" does not clearly show why the change was made. In this case perhaps the context behind the change (e.g. to test for the list command) should be added to the body or the subject title so other users who are reviewing the code will get a better idea of why the commit was done without having to look through at the diffs page.

    Agree with @vevek! Can confirm I used System.exit(0) and it works fine for me too. From this stack overflow discussion seems like having both Platform.exit() and System.exit(0) may actually be unnecessary. Relevant comment:

    I just want to point out that in this case the stop() method won't be called at all (at least with JavaFX 8 on windows) because System.exit() closes everything too early. In this case you might just call System.exit() only. But if you want to do something in the stop() method, I would recommend calling Platform.exit() here and System.exit(0) at the end of the stop() method if needed.

    Regarding your second point on "branch clutter", I believe it is possible to delete a branch after you have merged the changes into master if you don't need it anymore.

    I don't believe the extension is the issue, I used .jpg in mine without any issues.

    I did a few quick tests with my own repo, I think it was because you named your pictures Duke.JPG and User.JPG and your image paths were /images/User.jpg and /images/Duke.jpg. I could also replicate your error when the extensions had different case. Changing the extension names to be consistent (either jpg or JPG) fixed it for me.

    @tlylt If you would like to use a constructor of the parent class that requires parameters, you have to explicitly call super(...) with the parameters, else by default super() without parameters will be called.

    this issue seems to be similar to yours, can try and see if the solution provided by @tjtanjin works for you!

    CommandExecutor is a functional interface. Functional interfaces have a single abstract method and we can declare them by assigning a lambda expression or method reference to them.

    In this case, we do not actually call the executeCommand() method to get the return result, we are just assigning the method to the CommandExecutor function interface and calling the constructor with the CommandExecutor object.

    Perhaps writing this example as follows will make it more clear:

    
    CommandBox.CommandExecutor commandExecutor = this::executeCommand;
    
    CommandBox commandBox = new CommandBox(commandExecutor);
    
    commandBoxPlaceholder.getChildren().add(commandBox.getRoot());
    
    

    This link explains functional interfaces a lot better than I can! It only shows lambda expressions being assigned to functional interfaces, but according to the java 11 documentation method references can be assigned as well.

    Thanks @samuelfangjw for the explanation. I think I understand now. Because method references are a special kind of lambdas, and functional interfaces can be instantiated with lambda expressions, this::executeCommand is just an instantiation of the CommandExecutor interface.

    This is how I understand it too. Thanks for adding that "method references are a special kind of lambdas", I learnt something new today! From the official java tutorials, Method references "are compact, easy-to-read lambda expressions for methods that already have a name."

    Try changing -fx-font-fill to -fx-text-fill.

    I tried the following with your tp branch and it seems to fix your issue.

    
    .weekend {
    
        -fx-font-size: 16.0;
    
        -fx-font-family: "Abyssinica SIL";
    
        -fx-text-fill: red;
    
    }
    
    
    Screenshot 2021-03-08 at 2 04 29 PM

    One simple way to use it is to click on the codecov report and view the files in Diff, Coverage Changes or Files tab. It'll show you which lines are covered, partially covered or not covered by tests.

    Screenshot 2021-04-02 at 5 58 43 PM

    Hi, I downloaded a copy of your program from your add-tests branch and ran the tests locally using gradlew test. Got a few failing test cases as shown in the screenshot above. Can you double check to make sure the test cases run locally?

    Hi, I downloaded a copy of your program from your add-tests branch and ran the tests locally using gradlew test. Got a few failing test cases as shown in the screenshot above. Can you double check to make sure the test cases run locally?

    Same I could reproduce the same errors. You might want to run ./gradlew clean for a rebuild before running the tests again to see if it helps. Below are the detailed errors.

    LogicManagerTest > execute_invalidCommandFormat_throwsParseException() FAILED

    org.opentest4j.AssertionFailedError at LogicManagerTest.java:143
    
        Caused by: seedu.booking.logic.commands.exceptions.CommandException at LogicManagerTest.java:143
    

    LogicManagerTest > execute_validCommand_success() FAILED

    java.lang.IllegalArgumentException at LogicManagerTest.java:103
    

    LogicManagerTest > execute_storageThrowsIoException_throwsCommandException() FAILED

    org.opentest4j.AssertionFailedError at LogicManagerTest.java:143
    
        Caused by: java.lang.IllegalArgumentException at LogicManagerTest.java:143
    

    LogicManagerTest > execute_commandExecutionError_throwsCommandException() FAILED

    org.opentest4j.AssertionFailedError at LogicManagerTest.java:143
    

    Hi there, can confirm the same tests are failing. I did some very light testing, the tests in LogicManagerTest work when run in isolation but do not work when run together with other tests. Seems like your application takes into account some kind of state when parsing commands, I believe the state is not being reset, causing the tests to fail.

    Edit:

    The tests also seem inconsistent for me. Running the tests multiple times, sometimes all tests pass sometimes it fails.

    In LogicManagerTest, I added the following line to reset the state to inactive before every test and the tests don't seem to be failing anymore.

    
        @BeforeEach
    
        public void setUp() {
    
            JsonBookingSystemStorage bookingSystemStorage =
    
                    new JsonBookingSystemStorage(temporaryFolder.resolve("bookingSystem.json"));
    
            JsonUserPrefsStorage userPrefsStorage = new JsonUserPrefsStorage(temporaryFolder.resolve("userPrefs.json"));
    
            StorageManager storage = new StorageManager(bookingSystemStorage, userPrefsStorage);
    
            logic = new LogicManager(model, storage);
    
            ModelManager.setStateInactive(); // added this line
    
        }
    
    

    Seems like a short term band aid solution to the current problem though (shared state between tests).

    Can I confirm that the jar file will only be launched only with the command "java -jar example.jar" in terminal or will it be launched via a double click?

    I am wondering about this because the /data/tasks.txt file does not appear to be stored in the same folder as the executable when run via a double-click on my computer (Mac). It works perfectly when launched via the command line.

    Thank you!

    Hi Prof @damithc, what if we had used enums earlier than the given order?

    In the instructions it states "Implement the following increments in the given order." where the given order was "Level-1, Level-2, Level-3, Level-4, A-TextUiTesting, Level-5, Level-6, A-Enums". However in my case it made sense to use enums before Level-6. In this case does the tag ordering matter?

    As I understood it, deadlines should be paired with the "/by" operator and not the "/at" operator. Hence the need for events.

    In my case for deadlines I specifically ensure that it requires a "/by". If there is no "/by" it should be a todo command instead and hence I also throw an error. So for the case of "deadline return book /at Sunday" I throw an error.

    Thank you Prof @damithc

    Just to share an observation, I downloaded your final release and tried launching the application via a double click as well as using java -jar apollo.jar. In both instances, I noticed that the data folder was created in the directory of the executable.

    Thank you for testing it @tjtanjin ! 😄 For some reason it doesn't work on my computer specifically, but it worked well on my friends mac.

    @vevek I am sort of facing the same problem as you are (i am a mac user too and double-clicking on the jar file doesn't launch it). One workaround I found apart from launching from the command line is to right-click > open with > JavaLauncher.

    Perhaps that might work for you as well!

    Hi @chewterence ! Thank you for the suggestion! Unfortunately that didn't work on my computer. Seeing that it works fine on other computers I'll leave it be. 😄

    As said by the others, I prefer to use streams in areas where a traditional loop would become visually complex, and I can better hide this complexity through the use of streams.

    From this post on stack overflow, streams appears visually easier to understand, even in the case a simple loop.

    
    **Traditional Loop:**
    
    List<Person> filtered = new ArrayList<>();
    
     for(Person p : people) {
    
         if(p.age() < 19) {
    
             filtered.add(p);
    
         }
    
     }
    
     return filtered;
    
    
    
    **Streams:**
    
    return people
    
         .filter( p -&gt; p.age() < 19)
    
         .collect(toList());
    
    
    
    

    For the industry, as said by @w2vgd I think it makes sense to gain consensus from existing code in the brownfield project.

    I found this link from IntelliJ useful for some examples.

    Personally when I use safe delete I like to briefly check the safe delete conflict list to see if there are any areas I would not like safe delete to automatically delete something for me.

    If I recall you can right click the specific conflict to exclude it from safe delete. Although tedious, it would help avoid further issues down the line.

    I took a brief look at your iP code, I assume that the relevant part of your code in in 'Parser.java', namely the 'Parser::parseRemainder' right? Do correct me if I am wrong.

    @kouyk yup, thats the code I'm having the issue with. So after reading Prof @damithc 's comment, for 'Parser::parseRemainder()', should I be including a 'throws Exception' in its method signature, then remove the try catch block in the method, then I will no longer have the "missing return statement" error if i exclude the 'return null'?

    Sounds correct. Also as @w2vgd has said, instead of asserting that the user has input a wrong command. It would be better to throw an exception and handle it. I would have done something similar to this:

    ''''

    public Fruit parseCommand(String command) throws Exception {

    Fruit fruit;
    
    
    
    if (command == "apple") {
    
       fruit = new Apple();
    
    } if (command == "pear") {
    
       fruit = new Pear();
    
    } else if (command == "banana") {
    
        throw new Exception("what is a banana?");
    
    } else {
    
        // Should not be asserting here as this is a user error. Should throw an exception instead.
    
        throw new Exception("Invalid command etc");
    
    }
    
    
    
    return fruit;
    

    }

    ''''

    thanks all, can I also ask when should I use assert statements over throwing AssertionError()? The oracle docs shows AssertionError would be better for those Internal Invariants situations and for the same issue of "missing return statement" error inside a non void method. Coupled with java disabling assertions by default, I can't see when to use simple assert statements.

    I found this link to be useful!

    You may find this link to be useful. Has both the Java installation and the uninstall instructions below.

    Are you referring to the Luminus quizzes? The deadline for bonuses for those are 3 days after lecture (Monday Midnight). Only this week, week 7 has the deadline for the quiz extended.

    Your second question would be better answered in the link below.

    Refer to the Admin - Participation section here.

    Referring to this link,

    You can add more info into your commit message subject to differentiate between commits. You can also specify more information as necessary within the commit message body. There are some really useful examples in the link above!

    I used 'System.exit(0);' and it works fine for me. From this discussion on stack overflow and what @tlylt has mentioned, we can see why and when to use Platform.exit() vs System.exit(0):

    Taken from stackoverflow:

    If you call System.exit(...) the JVM basically exits immediately. So, for example, if you have code in the main(...) method >after' Application.launch(), that code gets executed after a call to Platform.exit(), but not after a call to System.exit(...). >Similarly, if you override Application.stop(), the stop() method is called after a call to Platform.exit(), but not after a call >to System.exit(...).

    Personally, I feel that pull request are a very good way to review and ensure that code being added to master branch is always in working order.

    Moreover, if another teammate begins working on a new feature from master, they start with a working master and not a potentially buggy one. If he started with a buggy master, it needlessly slows down his development on the feature he wants to work on.

    Lastly, if everyone works on the same branch, I think it would increase the amount of communication between those working on it, as a lot of coordination would be required.

    I agree with @samuelfangjw . In this case since the parameters of super aren't being used, you can omit super() as it would be called regardless.

    For my team and I, we enabled an option in settings where every pull request has to be reviewed by someone other than the author of the pull request. We did this to help us ensure that each pull request is checked at the very least and there can be no hasty merges performed.

    This setting is available through these steps.

    1. Under your repository

    2. Select your repo's Settings

    3. In the left pane, select Branches

    4. Under Branch Protection Rules, click Edit for Master

    5. Under Protect Matching Branches, enable "Require Pull Request Reviews Before Merging"

    6. Optionally enable "Dismiss stale pull request approvals when new commits are pushed"

    For my team, we have set a minimum of 1 review required, as well as enabled the option to "Dismiss stale pull request approvals when new commits are pushed" where if you pushed new commits to the branch for the PR, the updated change would have to be reviewed again.

    Screenshot 2021-02-26 at 23 31 16 Screenshot 2021-02-26 at 23 32 32

    Testing it out on my projects md files, I found that like you said it did not matter whether a long line was used instead of one that is kept consistently below 120 characters.

    The only benefit I can think of is being able to copy & paste into the md file without spending too much time creating line breaks just to ensure that lines are kept below 120 characters. I would still prefer to keep each line below 120 characters as it is easier to edit and maintain.

    Do we need to keep the tutorial pages such as AddRemark.md in our project? I don't think they would be relevant since the tutorial is based on the original AB-3.

    During today's CS2101 lesson, our team discovered that the UG and DG when printed to pdf have the AB-3 title at the top but our webpages do not have any AB-3 references.

    I think it has something to do with this file: _base.scss. It's under docs/_sass/minima

    Change the AB-3 under content for the .site-header:before under @media print to the name of your project.

    I haven't tested it yet though, but I hope it helps.

    I can think of 2 approaches to open pull requests:

    1. Open only when ready (New feature/change fully implemented in branch + tests and checkstyle cleared)

    2. Open as a draft pull request once you make a commit (Even if not fully implemented)

    Personally, I think option 2 should be considered as it allows for teammates to see your progress as you implement whatever change you are assigned (so if you get stuck anywhere, someone might be able to offer advice early on). A reviewer could point out changes to consider implementing while developing a feature rather than wait until the assignee thinks the feature is finished before asking the assignee to go back and edit the code.

    The only drawback I can think of is that there would be a lot more CI reports (including failing ones) generated.

    What does everyone else think?

    Let's say you have 2 computers and want to set up a second local repo.

    I noticed that when I cloned my remote to my second computer, only the master branch showed up.

    I did some googling and discovered that there is a way to "move" another branch into the second local repo. Here is the link: https://stackoverflow.com/questions/2294313/how-to-download-a-branch-with-git

    tldr, I did this:

    git checkout -t origin/branch-name

    And (insert branch name here) was successfully moved into my 2nd repo.

    I'm not sure why, I've added the JavaFX gradle dependencies to my build.gradle file, but trying to run my jar file (even within the same build/libs) throws this error.

    I just tried to set up CheckStyle but I got the following error when I ran checkStyleMain on Gradle:

    
    Unable to instantiate 'FileContentsHolder' class, it is also not possible to instantiate it as .FileContentsHolder, FileContentsHolderCheck, .FileContentsHolderCheck. 
    
    Please recheck that class name is specified as canonical name or read how to configure short name usage https://checkstyle.org/config.html#Packages. 
    
    Please also recheck that provided ClassLoader to Checker is configured correctly.
    
    
    
    

    I'm not sure what this error means. In addition, when I tried setting up on IntelliJ, I got this long error message:

    Anyone knows what's going on?

    For things like Task class in Level-3, are we allowed to make use of the partial solution shown in the webpage? If so, how do we note this down and give credit?

    Thank you Prof!

    Here's the updated screenshot:

    I tried removing this line according to what was said in the link:

    
    &gt;!-- Required for SuppressionCommentFilter to work -->
    
        <module name="FileContentsHolder"/>
    
    

    And got a TreeWalker error:

    
    TreeWalker is not allowed as a parent of LineLength Please review 'Parent Module' section for this Check in web documentation if Check is standard.
    
    

    This is what I have done so far:

    -Removed the FileContentsHolder module

    -Moved LineLength from TreeWalker to Checker

    But now I'm getting this on Gradle:

    
    Property 'allowMissingPropertyJavadoc' does not exist, please check the documentation
    
    

    I've tried following this link and adding this:

    
    <module name="MissingJavadocMethodCheck">
    
      <property name="allowMissingPropertyJavadoc" value="true"/>
    
    </module>
    
    

    and I've also tried removing the <property name="allowMissingPropertyJavadoc" value="true"/> line but to no avail...

    Update: I just realised there are 2 JavadocMethod modules, one for public methods, one for non-trivial private methods...

    And after I deleted both copies of allowMissingPropertyJavadoc, I got these, which I also successively deleted but gave up because I don't know if these are required for CheckStyle:

    
    Property 'allowUndeclaredRTE' does not exist, please check the documentation
    
    Property 'ignoreMethodNamesRegex' does not exist, please check the documentation
    
    Property 'allowThrowsTagsForSubclasses' does not exist, please check the documentation
    
    Property 'allowMissingThrowsTags' does not exist, please check the documentation
    
    

    For mine, the config folder was separate from the src folder, but I somehow managed to get it to work. These are the Javadoc checkstyle properties that I kept:

    
          <property name="allowedAnnotations" value="Override, Test, BeforeAll, BeforeEach, AfterAll, AfterEach, Subscribe"/>
    
          <property name="scope" value="public"/>
    
          <property name="allowMissingParamTags" value="true"/>
    
          <property name="allowMissingReturnTag" value="true"/>
    
          <property name="tokens" value="METHOD_DEF, ANNOTATION_FIELD_DEF"/>
    
    

    Everything else was deleted. Here's the full list of my deleted properties in original order for non-trivial private:

    
    <property name="minLineCount" value="3"/>
    
    <property name="allowUndeclaredRTE" value="true"/>
    
    <property name="allowThrowsTagsForSubclasses" value="true"/>
    
    <property name="allowMissingThrowsTags" value="true"/>
    
    <property name="allowMissingPropertyJavadoc" value="true"/>
    
    <property name="ignoreMethodNamesRegex" value="(set.*|get.*)"/>
    
    

    And for public:

    
    <property name="minLineCount" value="1"/>
    
    <property name="allowUndeclaredRTE" value="true"/>
    
    <property name="allowThrowsTagsForSubclasses" value="true"/>
    
    <property name="allowMissingThrowsTags" value="true"/>
    
    <property name="allowMissingPropertyJavadoc" value="true"/>
    
    <property name="ignoreMethodNamesRegex" value="(set.*|get.*)"/>
    
    

    After all these, I managed to get CheckStyle to run on both my main and test code. I'm keeping this issue open in case there's a more elegant solution without deleting these properties.

    I got it from here.

    I headed to this link from the user guide, which I accessed from the Week 3 familiarise with AB3 tP task.

    Edit: The CheckStyle file was updated to v8.32, but the build.gradle put 8.29. Not sure if I should change the build.gradle checkstyle to 8.32...

    Edit 2: Ok, so what I did was download the production release v0.1 source code and get the checkstyle file from there. Maybe that explains why it's different from what's on Github...

    Final Update: I manage to plug back in three properties:

    
       <module name="MissingJavadocMethodCheck">
    
          <property name="minLineCount" value="1"/>
    
          <property name="allowMissingPropertyJavadoc" value="true"/>
    
          <property name="ignoreMethodNamesRegex" value="(set.*|get.*)"/>
    
        </module>
    
    

    Thanks all!

    Thanks. I managed to get the build/libs one to work after changing the mainClassName.

    I found a javadoc checkstyle module for the one line before tags check: RequireEmptyLineBeforeBlockTagGroupCheck

    Tried setting it up in checkstyle but I got this error:

    
    Unable to instantiate 'RequireEmptyLineBeforeBlockTagGroup' class, it is also not possible to instantiate it as .RequireEmptyLineBeforeBlockTagGroup, RequireEmptyLineBeforeBlockTagGroupCheck, .RequireEmptyLineBeforeBlockTagGroupCheck. 
    
    Please recheck that class name is specified as canonical name or read how to configure short name usage https://checkstyle.org/config.html#Packages. 
    
    Please also recheck that provided ClassLoader to Checker is configured correctly.
    
    

    Anyone managed to set this up?

    Thanks, but I'm not sure if for this mod, it's okay to change the checkstyle version to 8.36

    If I may add on, another way to divide responsibilities would be to divide members based on administrative tasks like:

    1. Overall IC for merging pull requests

    2. Documentation IC

    3. Code Quality IC

    My team splits work based on features but we also have members in charge of different components and administrative tasks.

    E.g. One member has the following IC roles:

    1. Component: Logic

    2. Administrative: Documentation

    gitignore only prevents files that has not been tracked previously to be ignored from tracking.

    As the gitignore file itself has been tracked in the past, the option would not be available and, as above, should continue to be tracked.

    If you DO want to stop git from tracking the gitignore file (not recommended), you'd need to right click and select the "Stop Tracking" option in SourceTree instead.

    The FC command is actually similar to the Unix diff command that shows the differences between two files (in this case, the ACTUAL.TXT vs EXPECTED.TXT).

    If you try to replace it with the full path of where the executable exists, does it work? (i.e. this is usually found in C:\Windows\system32\fc.exe)

    If it does work, it may indicate a problem with PATH environment variables.

    Thank you, I replaced the FC command with the full path and it worked. What should I do to rectify the environment variable issue? (The other day I had some trouble with my Java version and I might have messed it up accidentally)

    https://cromwell-intl.com/open-source/windows-path.html

    Perhaps this would be helpful on Windows 10! Just ensure that the system32 directory is in the Path variable.

    Probably because of inconsistency between your local git copy and the remote GitHub copy?

    From the file path and where you’re running the JAR from, I think the relative path there would imply that your duke.txt file is in: ...\Java\compileroutput\artifacts\ip_jar\src\data\duke.txt, which I guess is not what you have set up? You can verify this if you create the src\data directory in ip_jar folder.

    btw, may i clarify what do you mean by create the src\data directory in ip_jar folder?

    Thx again!

    It looks like the file creation is failing because the src\data directory is not present in ip_jar folder. Which is why if you tried to create the aforementioned folders and it works, then you can implement the fixes that @tjtanjin has suggested 😃

    Personally, I don't think it's a good idea to commit compiled files unless there is a good reason for doing so. By definition, since git is primarily a version control tool, it makes sense to want to version control the source files instead of the compiled product.

    Additionally, I believe you may run into issues with rebasing later on (if you have the need to do it) with the inclusion of compiled files.

    Personally, I find that the second option would be good. What if the program crashes or encounters some other unrecoverable error before the save has happened? I think the efficiency of saving/deleting/modifying the file can be called into question as well when you have a larger number of Tasks.

    Inadvertently, this does also raise the question of what happens if the user does the following "unsupported" task:

    1. Save a Task

    2. Delete the storage file

    3. Try to save the task again

    This will probably be classified as unsupported behavior and not an intended use of the application. However, should we as developers foresee these types of issues and attempt to make provisions for them?

    I think this would be handled as an IOException within the method responsible for saving tasks. Ideally the code should re-generate the missing folders/file if they are found to not exist but upon a failed creation (probably due to permission issues), it should terminate the entire program with a proper exit message.

    That's true. I was considering this possibility because the way I implemented my add task function only appends the new task to the end of the opened file.

    If I were to re-generate missing file structures, then I would also need to consider adding previously existing tasks in the list to the file as well, otherwise, there will be a mismatch between what is in the file vs what is in the task list at run-time. This could cause problems as well if the user modifies a task added before the file was re-generated (e.g. mark a task as done in the application, and this task is present in memory but not present in the file on the user's hard drive).

    And there could be various more "unsupported" uses of the application or ways to break it like this that I hadn't really thought about as well.

    There's a checkstyle.xml included in the addressbook-level3 for the tP, which I believe we're supposed to be able to use:

    https://github.com/se-edu/addressbook-level3/blob/master/config/checkstyle/checkstyle.xml

    I feel like think this is very situational and they are good for both scenarios. There are cases where streams are more readable than for/while/if, especially if there are many scenarios to be checked for, and writing a stream and collecting them could look much cleaner and readable. On a personal level, I'd use "traditional" for/while/if for simple checks and use streams if the loops are more complex.

    But, it's also subjective. As you have pointed out, some of us are more comfortable with traditional loops as opposed to streams. One requirement may be to have code that's able to be maintained or better understood by others through the course of a project, and it may be necessary to adjust to that. Otherwise, personally, at the end of the day, as long as it gets the job done and conforms to coding standards and quality requirements, from a SE perspective I don't think there's a "right answer" unless there's a specific scenario in which it forces you to use one over the other.

    Just my 2c. 😃

    The data in the data/addressbook.json is populated by the sample data utility if it is not present, so I think if your working data is messed up later you could let it re-populate again later.

    Personally, I did not remove the address field in the data file while doing the removing field tutorial since it's not in git and by nature it's fine for JSON files to have extra fields anyway (although maybe in an ideal scenario the software developer would code to remove unused fields in future revisions to patch if they are no longer necessary).

    Hi,

    In IntelliJ, have you set the project to be built using Java 11?

    File -> Project Structure -> Project Settings -> Project -> Project SDK. (shortcut Ctrl-Alt-Shift-S)

    Hm... Does the project SDK option or something similar show up for you here?

    Could you share what was the problem that the automated smoke test was finding? That might make it easier to narrow the issue down.

    I’m guessing it’s an issue with the macOS CI client on Github’s end?

    I have followed the instruction on smoked-tested catcher and done this task from Wednesday. However, the TP dashboard did not update this task done for me.

    Hi everyone,

    I'm having some problems with adding configuration gile for Checkstyle. I downloaded the source code of AB3 and then copy the config folder to my IP repo. After that i started adding configuration file to Checkstyle as instructed.

    But then an error appeared:

    I'm not sure if I'm doing wrong at any steps and find no clue about this error also.

    Please send some help.

    Thank you.

    Remember to give sufficient details e.g.,

    • Your development environment (IntelliJ version, Java version, OS, ...)

    Intellij 2020.3.1 Community Version, Java 11, Windows 10 64bit

    • Relevant code, error message, stack trace

    Access is denied.

    FC: cannot open ACTUAL.TXT - No such file or folder

    Hello Prof and other students. I get the above message when try to run the .bat file in A-TextUiTesting. I think my problem could be the command prompt does not have the write permission to that folder so Actual.txt is not created. I have search Google for some solution but seems like nothing works with me. I don't know if i understand my circumstances correct or not? Please give some help. Thank you. Below is my current repo status after doing level-4

    i have followed your advice and get to know that the problem of "Access denied" is this line:

    if not exist ..\bin mkdir ..\bin

    oh thank you for your advice, i ahve tried the command using administrator privilegde and it has clearedd the access denied error. However, i'm left with this error message:

    Actually, when i read about testUiTexting, i realize something that i'm not sure that need to change something or not, and how to change that also.

    Do you know how can i change that?

    For this step, because i don't have Main class so i tried to change that *.java into Duke.java but it results in this:

    Is it because my path is wrong or not? any recommendation for the path change?

    oh i managed to get it with your advice. oh and i also think in the same way as your advice also, but i don't know the .. stands for the dir of test-ui-text, i thought it is the path of my cloned repo because in the bath file it got something "..\src\main\java" and src is in the cloned repo folder. why does the relative path acts like that?

    oh and btw is this the correct output?

    @candyhy thank you for pointing that out for me.

    @tjtanjin thank you so much for your help for my issues

    @damithc Thanks prof, that was really helpful as i don't know .. refers to the parent dir

    Solved and closed

    Sorry, can i ask that this class name is like Duke only or it should come with its path. Cause i try with Duke only and cannot

    yes i have both 2 files in config/checkstyle. And also, I do not think that this is related to Gradle cause I'm just adding the configuration file for CheckStyle. Am I right?

    i figure it now with the same solution from this issue:

    https://github.com/nus-cs2103-AY2021S2/forum/issues/92

    What is problem of the checkstyle.xml, why changing its content makes it work?

    @damithc Hi prof, I'm having the same situation as @Hzxin so I think it's better for me to include in here also. My tp weekly progress is also: Did not contribute any commits to the master branch of the team repo. Although I have made some pr and do the merge by myself also to team tp repo. Here is an example of pr by me and merge by me also:

    This merge and other merge of my pr has been done on Feb 25, but the tp dashboard does not update it for 2 days already. I wonder if any bug in the checking system or it's my fault somewhere. I also think that I have followed the step for the tp.

    Yes, Prof. I have created bugs using GitHub interface, CATcher web and CATcher app also.

    @damithc Yes Prof. I just created one more bug report.

    Tks Prof @damithc. It is marked as done now. Yes, I deleted the first issue because it was not created with catcher. Next time I will pay more attention to that point.

    1. Use the win+shift+s shortcut (launches snip and sketch).

    2. Then just select the items you want to screenshot.

    3. The result is automatically copied to the clipboard and you can paste it into CATcher easily.

    4. To annotate the picture, clip the pop-up notification on the bottom right and draw, then a ctrl + c will copy the annotated version!

    Note there are a few ways you can snip the image. (rectangle select, free select, windows select, fullscreen select)

    The user guide uses this as a quotation but when we paste this into java, it does not register the same as a " (a normal quotation from a keyboard input).

    If the user decides to copy and paste commands from the user guide and gets a parsing issue, is this a bug on us?

    This question arose as some of the developer guides from the last sem had their names written beside the parts they wrote.

    From what I know, there are 2 main ways one can go about checking and approving PR's:

    1. We approve the PR by just looking at the files changed and see if the code looks good

    2. We pull the PR locally, test it out and then after testing the PR and code changes related, approve it

    The first method is obviously faster but prone to bugs since if no checks are done in the application itself, we might not know if someone's change broke anything.

    The second method is more meticulous but takes up significantly more time especially if the PR is large.

    Is there any recommended way to clearing PR's?

    As the title suggests, can we change the format of our user guide to make it look better? Or should we follow AB3's format?

    The link for reference.

    I am getting an error when I run a certain command in Intellij but not when I run it in VSCode.

    Specifically, when I run the remove command. In both cases, the item will get removed. However, In VSCode, the console logs look normal but in IntelliJ, they give me many errors.

    Intellij Error:

    VSCode's lack of errors:

    Take note that these are both running the same command, deleting the same item.

    Just found this super weird and would like to ask if anyone knows the reason why this may be the case.

    Library

    Apache Commons Lang » 3.0

    Purpose

    To check enums with the method isValidEnum

    License

    The Apache Software License, Version 2.0

    Wow, what a coincidence, I was thinking of this question as well.

    My take on this would be that avoiding bi-directional relationships is better since if you decide to change one class down the line, having a bi-directional relationship would cause a lot of issues.

    Also, oftentimes I feel that a bi-direction relationship can be easily represented with a unidirectional as well. So unless bi-direction is strictly required, I feel there is no need to use them.

    Regarding the second part of your question, I think it is heavily dependent on what you're comfortable with. If you feel like there may be changes to some essential part of the code down the line, unit testing is definitely a better choice as it won't be too dependent on other parts of the code working. However, if you feel like you're close to completion, integration testing could be a good sanity check to see if different modules of your product are working.

    Thanks!

    I agree with @tjtanjin and @tlylt, after seeing @tjtanjin use it for our team, I think the draft PR is pretty good.

    A possible alternative could be to add a tag with a "still working on this" on a normal PR, in case you want to let your teammates know. (To prevent getting spammed with emails)

    Thanks, prof! I meant the content structure so this answers my question!

    Thanks prof, I'll leave this post open (for more visibility) in case anyone else was wondering.

    Hi prof, sorry for late reply, we managed to solve this by using an escape character!

    Hi Prof @damithc the check for macos is not loading (10mins in and it had not started), I refreshed twice and the issue still exists. The build is not starting though it is queued.

    Hi prof @damithc so recently made commits that have 200 + lines of contribution but this is not reflected in the total LOC in reposense. My total LOC is currently at 256. But if you would look at the total LOC below it is definitely more than just 250.

    I found out that the issue is in CalendarWindow.java that the system does not check all the lines that I have contributed.

    I have over 200 line changed in CalendarWindow.java in the commit but only 34 lines is recorded by the system (first part of the file)

    So only changes up to line 68 are recorded. May I ask is there something wrong here 😮?

    Hi I have imported the javafx media as dependencies, and in my pull request the checks were alright.

    However, when I merge the pull request, a check (macOS latest) failed and I'm not sure how do I rectify this problem. (I did not modify the build.gradle other than the 3 lines I've inserted). Anyone knows how to solve this issue? Thanks in advance 😄

    Hi so im trying out css to make fxml format look neater. I'm looking at how the mainwindow.fxml does it with the darktheme.css and below is my css code:

    css

    Here is the code in my fxml, basically im trying to replicate text:"Sat" properties to text:"Sun" with css (styleclass):

    label

    I have also added the css at the start of the fxml file

    css_added

    However, the Ui does not register the css style

    calendar_ui

    the text:sun is not in red and not of the same font and size as dicpicted in the text:sat.

    Anyone knows what is the issue here? Is it because there is no presense of ids? Thank you in advance 😃 !

    gui

    Hello for my javafx code I have been following the tutorial https://se-education.org/guides/tutorials/javaFx.html. To produce the gui as shown above, I simply edited the method getResponse() in Duke . Currently the gui is unable to print the greeting message and close with the bye message. Any tips on implementing the two functionality cleanly? Thanks in advance!

    main error ui1

    Hi I'm encountering NullPointerException when running Duke so I narrowed down and realized its my ui when running in a duke.run(). If it simply runs outside of the duke.run() it works fine. I'm not sure why is this so. First picture is my Duke.java, second picture is the error occurred and third is the write up of my Ui.java. Thanks in advance!

    git sourcetree

    Hi guys newbie here. My source tree was looking good but as I was looking to rename my commits I did some rebase commands and in the end now my source tree is a mess 😦 The pink branch was my main branch but now it does not have a "branch" to it. How do I move my master to the commit of A-more OOP? Thanks in advance!

    Screenshot_3

    Okay looks good now thanks so much prof 😄!

    Thanks @onnwards @damithc @tjtanjin! Will do a better job at screenshotting next time! Also, yeah the error was from the constructor I did not initialise my ui there so there was a null pointer error to the Duke attribute's ui. Thanks so much!

    @w2vgd Thanks so much I think it works now!

    guigreet guigreetandbye

    Oh alright thanks! @samuelfangjw 😄

    Oh yes it works now thanks prof! @damithc

    Ah noted thanks prof @damithc I copied those codes so I did not check the author formatting and I have not used the credit formatting as of yet. Will update it and it should be fine thanks!

    Okay looks like it works now!

    When searching something in the search box of the top right corner in the website, there is many search results going beyond the scope of the screen. When I scroll down and want to see them, only web pages scroll down but the search results display bar does not. Is it an issue of the website?

    @damithc Hi Prof! I'm from T13-2. We have updated the DG and wrap up v1.1 milestone on March 4th before 12am. But the tp progress dashboard haven't been updated yet so far. Could you check it?

    Hi firends! Recently I'm struggling with how to resize the dialog box as the amount of text changes. And I find that what we can do is Add an HBox to the outer layer of the Label. Then set the minHight of Label as -Infinity and the maxHight of HBox as -Inifinity as well. More explicitly:

    
    <HBox maxHeight="-Infinity" {other attributes}>
    
        <children>
    
            <Label minHeight="-Infinity" {other attributes}>
    
                 {inner layers}
    
            </Label>
    
        </children>
    
    </HBox>       
    
    

    I hope this will help those who are facing the same problem as me! More comments or better solutions are welcome!

    Hi friends! I have a question about debugging with gradle. When I try to use printf() method to debug, it shows nothing in the console and it's hard to get used to it. Could you tell me how to fix it?

    Hi friends! When I follow the guidance of JavaFX tutorial, it shows that the following error in the MainWindow.fxml. Could you tell me how to resolve this problem?

    Hi firends! When I use Gradle to check style, the violation report shows that position of import statement 'Java.uitl.Scanner' is wrong, and it should be in the 'STANDARD_JAVA_PACKAGE' group. Could you tell me how to resolve this violation?

    Hello friends! I'm torn between using static variable and function in Class Duke and not using it but create an object of Duke in main function. The one I'm using right now is making it static. Will this result in any negative effects?

    Hello, took CS2103 last semester myself, here to give advice when necessary!

    While it would not have any issue for the requirements now, you might want to consider the usage of your Duke Class down the line with evolving requirements. (What is the purpose of the class? Right now from your code, it seems to be handling a lot of functions such as parsing and prompting)

    I do think that a possible negative effect in the future might be the fact that you might be "overloading" your Class Duke right now.

    For example, if you see next week's requirement, where you need to implement a "Find" function, you need to refactor your Duke Class, making it even longer and more complex. Hence more prone to errors and decreased readability.

    A suggestion that I have is to divide these functions you have into different classes (perhaps Parser.java). This would allow you to better define the purpose of your Duke Class, and ultimately make your code base as a whole neater and more readable.

    This comes hand in hand when you start to implement testing code, which is very often a reflection of your existing code.

    These are just some food for thought and may not be the best way to implement it, but the considerations behind the design is the key focus here! Personally, I often peered ahead in the weeks to observe the different requirements, and altered my current code accordingly.

    Yes, that is exactly what I'm worried about. The suggestion to divide functions into different classes is helpful to me. Thank you for your advice!

    Hi Nicholas! Here is my naive idea. Maybe you could choose to put the relative function into one class to simulate OOP. But I remember that the requirement of iP is to use OOP most. So you could consider changing the structure of your code and add more features about OOP. Hope this helps!

    Hi @w2vgd, here is one of the explaination on google. Maybe you could refer to it.

    Java modules are the simplest module type and represent a basic Java application project, whether it's a command-line tool, a Swing application, or a JAR library. When configuring this type of module, you can specify a set of Java source paths that will be compiled to a single class folder. The basic capabilities of this module are carried over into the web module.

    The web module is an extension of the Java module that adds support for web applications. In addition to providing the ability to create and build Java sources, it lets you edit your web application's deployment descriptor, build and deploy it to your application server, and configure other web application capabilities. You create a web module for each web application in your project.

    On my own opinion, it seems that it doesn't matter for this project. JAVA_MODULE is enough to satisfy the requirement since WEB_MODULE is an extension of the JAVA_MODULE and we don't need any web applications so far. Hope this works!

    The order of imports should be as follow (from top to bottom):

    1. static imports
    1. standard java imports (imports from standard java api, e.g. import java.util.Scanner, java.time.LocalDate, etc)
    1. special imports (such as imports from your own packages, e.g. import duke.commands)
    1. third party imports (such as from javafx library)

    Thanks! Got it.

    Where did you place your MainWindow.java file? Did you import it if you placed it in another package?

    Got it. I place it in a seperated package. So the controller should be "{packageName}.MainWindow". Thank you!

    @damithc Thank you Prof!

    Noticed. Thank you prof!

    When I look up the policy on reuse, I found this: https://nus-cs2103-ay2021s2.github.io/website/admin/appendixB-policies.html#policy-on-reuse

    What stumped me is that it both asks that "The work comes from a source of 'good standing' (such as an established open source project)." and it gives provisions to "reuse code snippets found on the Internet e.g. from StackOverflow answers", which is not an established source.

    In my case, I'm trying to use https://stackoverflow.com/a/13564498/11358676 for code on Levenshtein distance, and I'm largely copying code wholesale. Can I use it as is, or should I instead use an established third party library like "Apache Commons Lang3"?

    I keep forgetting that the quizzes are due at 2pm rather than midnight.

    • Is it possible to set the deadline to midnight for better clarity?

    • Are we only counting the best x quizzes out of y?

    I ask this because I'm worried about my marks.

    Lets say I have code that goes like:

    
    switch(x){
    
    case 1:
    
        return "Bomb";
    
    case 2:
    
        return "Gun";
    
    default:
    
        return "Knife";
    
    }
    
    

    Do I have to insert breaks?

    If we complete A-Streams and A-Lambdas in the same commit, how should we name the branch? Does the participation code need us to name the branches for those "branch-A-Streams" or can we just name them something sensible like "branch-A-Streams-Lambda"?

    So A-Gradle seems to expect some extra things need to be done for the Gradle to be set up for unit test, but it seems that I can just run "gradle test" already? What exactly are we expected to do for "Recommended: Set up gradle to run unit tests."?

    OK, so I only cleared my backlog enough to start on week 4. The problem I immediately encountered is that all of the code I have been assigned to is too refined for me to find any problems with. All of the coding style violations have been beaten out as far as I can see 😕

    Pls advice, I am very stressed from being so behind

    Hi. My tutor said that we have a grace period of 1 week before our iP submissions become officially late. Is that true?

    So how strictly do we need to parse our input?

    Do we have to strictly follow the examples provided?

    So "deadline return book /by Sunday" should parse into new Deadline("return book","Sunday")

    but "deadline return book /at Sunday" should throw a parsing error by not recognizing /at as special

    same with "Deadline return book /by Sunday" with capital Deadline

    Or can we have loose parsing rules, so that all of the examples I gave above would create a deadline?

    I understand that Level-1, Level-2, Level-3, Level-4, A-TextUiTesting, Level-5, Level-6, A-Enums are all things we need to have tags for, with A-Enums being optional. However, if we do the extensions: A-Classes, A-Inheritance, A-Exceptions, A-Collections, do we need to tag them to get credit?

    tood, deadline, event have all very similar code, so we could probably use enum for that.

    I sincerely think that trying to use enums is a poor idea. Using exceptions is useful as a pseudo goto instructions, but I think enums are too clunky to implement right now.

    Also, am I right to say that we can skip doing enums and still count as a completed project?

    I commented on a few PRs, and I think I gave good reviews? Can some tutors help me sanity check my reviews, or am I alone? Pls help, bit stressed, some guidance will be much appreciated.

    I get that, but it seems weird to separate them in my case, since it doesn't seem sensible to implement streams without lambdas, or vice versa. At least in my case, they are tightly intertwined, and belong together in one logical commit. Anyway, thanks for your feedback.

    Dear all,

    I recently changed the package name of tp from seedu.address to seedu.sochedule. However, upon running the gradle for testing, I noticed that I have doubled test cases now. An screenshot for the test result has been attached at the back.

    Thus, can I check if this issue is relevant to my intellij setting or gradle or some other file?

    Some possibilities ruled out:

    1. I have checked that the test under seedu.address have disappeared and I only have on test folder under seedu.sochedule

    2. For the build.gradle file, the only line changed is the mainappname as shown in the image below.

    Thank you so much!


    Update:

    CI via github action works and has shown no error. I highly doubt it may be linked to my intellji Junit test, maybe dependency? Can anyone help to point out the possible files to look further into?

    Alternatively, we may make use of the .next() from the Scanner object you have created. It automatically takes in the next String in the input, which is the command word in our case. Then, based on the command, we can carry out relevant steps, for example a .nextLine() to read in the rest of the line.

    However, I do agreee with @tjtanjin that his way of splitting may be more elegent during implementation:) Hope it helps in providing another perspective.

    Maybe I can share a bit about how to move the tag to the future commits in case anyone is curious. Personally I find it easier to be done via SourceTree. It is essentially just deleting the old tag and create a new one😃

    1. Click on the commit with the tag you wanted to move.

    2. Right click and click on tag to open the dialog where you created the tag.

    3. Click on "remove tag" and select the tag you wish to change. I find it useful to also check the "remove tag for all remotes".

    1. After removing the tags, just select the more recent commit and create the tag for it. And then your tag is 'moved' there!

    2. However, do note that these changes may distort your ordering of tags when u click on 'tags' page for your forked project on Github. For example, mine looks like this now T_T Even though the commit with tags "A-Enums", "level-2" and "level-4" are older than that for "A-TextUiTesting", these tags are still behind them.

    Hope this can help anyone:)

    Thanks @tjtanjin and the sourcetree version is here:)

    Maybe I can share a bit about how to move the tag to the future commits in case anyone is curious. Personally I find it easier to be done via SourceTree. It is essentially just deleting the old tag and create a new one😃

    1. Click on the commit with the tag you wanted to move.

    2. Right click and click on tag to open the dialog where you created the tag.

    3. Click on "remove tag" and select the tag you wish to change. I find it useful to also check the "remove tag for all remotes" so that the tag pushed to Github is also removed.

    1. After removing the tags, just select the more recent commit and create the tag for it. And then your tag is 'moved' there!

    2. However, do note that these changes may distort your ordering of tags when u click on 'tags' page for your forked project on Github. For example, mine looks like this now T_T Even though the commit with tags "A-Enums", "level-2" and "level-4" are older than that for "A-TextUiTesting", these tags are still behind them.

    Hope this can be useful:)

    @tjtanjin Do you think it is worth to share with the rest that they are allowed to use this library also? (As it has been approved, they dont really need to get it approved again I suppose.) This is just a personal thought haha.

    @damithc I see, thanks for the reply:)

    @w2vgd Thanks for the solution! It solves my issue as well!

    You can have a look at the build output! Runtime errors (if any) will be shown on the left panel. You can also use the debug mode to debug for the possible errors. Everything is the same as CLI mode:) Hope it helps.

    Updating the main class name in build.gradle works for me! Remember to include your package name as @tjtanjin mentioned if needed:)

    @rajobasu I have the same queries as @nickyfoo. So does it mean we have to manually delete every relevant usage of the "address" in the project code? I did it but found it very tedious and inefficient and some of them are only highlighted after running the tests. Wandering if there is a better way or a recommended flow of thoughts, like you can do this first, then that, then ....

    Many thanks!

    Sorry Prof @damithc , we overlooked this part:( Can I kindly check if not renaming the package will affect the grading of our tp since it is stated as optional? Thanks

    Thank you prof for the answer!

    Hi prof! According to the instructions on the CS2103 website:

    we are supposed to put Ui.png under docs directory for it to be shown in the ip showcase page, but on the ip showcase page I noticed that the webpage is actually trying to fetch the picture from >https://USERNAME.github.io/ip/Ui.png>, which means if the product website is not set up using GitHub pages exactly as instructed, it might not be shown in the ip showcase page.

    Do you think it may be better to use >https://raw.githubusercontent.com/USERNAME/ip/master/docs/Ui.png> as the url of the picture? Otherwise, maybe it woule be better to state explicitly in the instructions that we need to serve our Ui.png at >https://USERNAME.github.io/ip/Ui.png>?

    @colintkn I think perhaps the NoSuchElementException is thrown when EOF of the input file is reached. If this is the case, you can include a bye command at the end of the input file so the program will exit before reaching EOF.

    The coding conventions can be found here:

    >https://se-education.org/guides/conventions/java/intermediate.html>

    From the module's website: Other Links -> Java Coding Standard

    I think it's because you have not pushed the changes on local master branch to the remote master branch (so the local master branch is 2 comits ahead of the remote master branch)

    I followed ur instruction and now I have Error: JavaFX runtime components are missing, and are required to run this application"when running gradlew run

    I also encountered this error earlier. I got it to work after I followed the instructions here.

    You can also try the following to give gradlew executable permission with git:

    
    git update-index --chmod=+x gradlew
    
    

    Reference: <https: 21691202 stackoverflow.com questions how-to-create-file-execute-mode-permissions-in-git-on-windows cwf="C:\repos\nus-cs2103\dashboards-base\contents\cs2103\forum-activities-panels.mbdf"> </https:>

    Glad it worked!

    @JQChong I tried your solution but it didn't work.

    Just for your information, to make @JQChong 's solution work, you'll need to run chmod +x ./gradlew before calling gradlew in your gradle.yml 😊

    🍺

    Using an HBox seems to be an interesting solution! I did it in a slightly different way.

    I used a javafx.scene.shape.Rectangle as the dialog box. To print the message within the Rectangle, I wrapped both the message node and the Rectangle inside a javafx.scene.layout.StackPane which resizes automatically so that all its children are within its boundary. However, the Rectangle does not resize automatically. Therefore, what I did was rectangleNode.heightProperty().bind(stackPaneNode.heightProperty()); so that the Rectangle's height is always equal to the height of its parent StackPane.

    One benefit of this method is that you can easily replace the Rectangle with any other shape (e.g. javafx.scene.shape.Path) without changing any other code.

    A more complete Java code snippet:

    
    Rectangle rectangleNode = new Rectangle(300.0, 20.0);
    
    rectangleNode.setFill(Color.AQUA);
    
    
    
    StackPane stackPaneNode = new StackPane();
    
    stackPaneNode.getChildren().addAll(rectangleNode, messageNode);
    
    
    
    rectangleNode.heightProperty().bind(stackPaneNode .heightProperty());
    
    

    Maybe you can try adding | at the start and end of all rows, including the header and the separator row. I'm also not sure if you are allowed to have &gt;br /> tags in a table.

    It just gave me a little bit of confusion 😅. Since the instructions said using GitHub pages and jekyll is just "one simple way to do it", I thought it is okay to do it in other ways.

    That's why I suggested the following. 😁

    Otherwise, maybe it woule be better to state explicitly in the instructions that we need to serve our Ui.png at https://USERNAME.github.io/ip/Ui.png?

    Are you running it on Linux?

    Class JsonSerializableAddressBookStorage does not exist.

    I believe it should be JsonSerializableAddressBook instead

    Screenshot 2021-03-30 at 2 12 36 AM

    I have implemented my GUI entirely in code, factorising my code into MainWindow, DialogBox, to prevent overloading of my Main class. May I check if it is necessary to use Fxml, as seen from the tutorial guide provided?

    Please advise, thank you!

    Hello, sharing this tip to help format code style in IntelliJ to better fit module java style guidelines.

    To configure switch statements:

    Go to Settings > Editor > Code Style > Java, select tab "Wrapping and Braces", scroll down the list to 'switch' statement, uncheck the option "Indent 'case' branches".

    Screenshot 2021-01-25 at 2 10 00 PM

    Then reformat your code by right clicking on the Java folder and clicking on Reformat Code.

    Screenshot 2021-01-25 at 2 12 09 PM

    You can also configure code styles in other ways under this section. Hope this helps!

    Personally used static functions in Duke class, and don't think there is any difference in functionality for either options. Probably personal preference:)

    Edit: I stand corrected hahhah @kormingsoon 's rationale hits - in view of design rather than simply functionality 😂

    oh and btw is this the correct output?

    Hello, based on the picture you attached, I believe that your EXPECTED.txt has some extra spacings somewhere.

    It should show(for windows):

    Comparing files ACTUAL.TXT and EXPECTED.TXT

    FC: no differences encountered

    Hope this helps, thanks!

    Hello, I believe you have to update your main class name in build.gradle!

    (Application clause)

    Okay thanks prof! will play around with FXML, just wondering if its ok to stick with code if I find it to be more readable in the end 👍

    To be updated 😛

    Screenshot 2021-02-04 at 1 06 29 PM

    agree with @w2vgd that it is too hasty to conclude default cases and else clause should be used solely for throwing exceptions/errors. Printing in the default case can help debugging(to affirm that the switch clause is reached) since there can be new cases as we add new features to a software.

    Personally, I have used switch clauses in non-void methods, and I find no issue in the return statements as the default clause is never reached. Maybe you can consider handling all cases in the switch clause so the default case will never be reached? Variables can be declared as Integer count; instead of Integer count = null;

    Hope this helps! maybe you can consider showing us your code for more concrete help:)

    agree with @w2vgd that it is too hasty to conclude default cases and else clause should be used solely for throwing exceptions/errors. Printing in the default case can help debugging(to affirm that the switch clause is reached) since there can be new cases as we add new features to a software.

    Personally, I have used switch clauses in non-void methods, and I find no issue in the return statements as the default clause is never reached. Maybe you can consider handling all cases in the switch clause so the default case will never be reached? Variables can be declared as Integer count; instead of Integer count = null;

    Hope this helps! maybe you can consider showing us your code for more concrete help:)

    @candyhy I'm not very familiar with throwing and switch statements, but if you're enumerating all your cases ( not using the default case as your last case to handle the last possible input to the switch statement ), unless your method that contains the switch statement explicitly throws something in its method declaration, your default case should cause the "missing return statement" if it does not have a return statement. Please correct me if I'm wrong

    @CSmortal

    If your cases handles all possible enums, and the default case will never be reached, then throwing an assertion error in the default case does not require an exception to be added to the method signature. In my opinion, throwing an assertion error in a default clause that shouldn't be reached makes sense.

    Attached below is an example of use of assertion error in default clause:

    However, this scenario only applies when you can list out all possible case values, because assertions are meant to detect flaws in the programmer's code and not because of an invalid user input (this should be handled by exceptions). So as what Prof @damithc and @kouyk has mentioned, you may want to handle the exception in the calling parent method or just handle the issue directly at the place where the issue occurred.

    Hi yes i later noticed that the checkstyle tests have been passed. Based on your error messages, I believe it could be a type issue. Perhaps your string values were not enclosed in double quotes, which is necessary in JSON. You might find this link useful as they seem to have encountered the same error as you:

    https://stackoverflow.com/questions/29856116/handling-unrecognized-token-exception-in-custom-json-with-jackson

    I can pass all test cases locally with gradlew test or running the whole test folder but some test cases keep failing on GitHub. This branch has already been merged with the latest master.

    Hi, I'm encountering an issue with the position of the app window.

    When I run the app by running Main in Intellij, the app is running and the app icon appears on the task bar (circled in red in the image below), but the app window is no where to be found. I've tried deleting the .ideas files or resetting workspace.xml but none of these worked. My teammates are still able to run the app as usual so I suspect there's something wrong with my Intellij. My Intellij version is 2020.3.3 Ultimate.

    Hi, to set up gradle I followed the tutorial on https://www.jetbrains.com/help/idea/gradle.html#gradle_add_module to add a build.gradle file and installed gradle to my project upon prompted. After installing, my program fails to compile and I'm prompted with the message displayed above. I have added relevant junit dependencies into build.gradle but the problem still remains. Can anyone tell me what's the issue here?

    Hi, I'm facing this issue when executing runtest.sh under wsl. I have only modified input.txt and EXPECTED.txt and nothing else. Wonder if anyone is facing similar issue.

    I have resolved the issue, it's because I did not install packages such as jdk11 or dos2unix under my WSL but only on Windows. Some learning points for people who might also face such issues under WSL:

    If the output says command not found, navigate to that specific line and run that command in your WSL to see what is the issue. Most of the time the system will tell you where to look for solutions.

    Thank you @damithc @tjtanjin !

    Try after running gradlew clean to get rid of any output files created earlier.

    Hi prof, I tried but still doesn't work.

    Hi prof, I tried but still doesn't work.

    Try deleting the out folder manually. BTW, what happens if generate a JAR file and run that instead? Does the Window show up?

    Deleting the out folder doesn't work as well. Running the JAR directly is okay, the window shows up properly.

    Delete the preferences.json file at the root of the project folder and see if that works.

    It worked after deleting preferences.json, thank you prof!

    Screenshot 2021-04-02 at 5 58 43 PM

    Hi, I downloaded a copy of your program from your add-tests branch and ran the tests locally using gradlew test. Got a few failing test cases as shown in the screenshot above. Can you double check to make sure the test cases run locally?

    Hi, I have double checked and my team mate has also tried testing my program, but the test cases still run locally. Can I trouble you to take screenshoots of the errors you have discovered so that I can try to make some sense out of it? Thank you!

    The issue is resolved after adding the logic suggested by @samuelfangjw. The issue is caused by failure to reset class-level states which are shared by several commands. I'm still unsure about why some systems can run some system cannot but at least the error on Java CI has been resolved. Thank you everyone for your kind help:D

    I have followed the steps given in the JavaFX Tutorial. However, at the final step when implementing FXML, I encountered an error in my MainWindow.fxml file whereby IntelliJ is unable to find an XML from the given xmlns.

    A snapshot of the MainWindow.fxml file is given below:

    As a result, when I try to run the main() method from my Launcher class, I get a NullPointerException. Does anyone know how to fix this issue?

    I am following the instructions given by the JavaFX tutorial part 1 - Introduction. However, when I try running my Launcher's main() method, I encounter the error below:

    I have tried googling around but am still unable to find a fix for the issue. I also notice that IntelliJ is given me three errors for my build.gradle file as shown below. Could this be causing the problem? And how can I fix this?

    I had completed the A-Jar level for Week 3 within the deadline, however, the iP progress tracker did not detect it.

    I have included snapshots below of my .jar file upload as a new release.

    Does anyone how to make the script detect my level? Also, will my level be counted as overdue since the deadline is over?

    Alright I will try that, thanks!

    Yup! I've just checked and the script has picked up my A-Jar level after committing with an A-Jar tag. Thanks everyone!

    Managed to fix the issue thanks to my teammate who encountered the same issue.

    I had to change my Duke() constructor such that it didn't take in any arguments. Apparently having the constructor take in arguments causes the bug.

    Yup I haven't implemented packages yet, do I need to do that for this to work?

    As for the stacktrace of the exception, I've made a snapshot of it but I think it just points back to those two red lines:

    I am currently storing my images in the folder here:

    As for the project classpath/source path, I tried marking my resources folder as "Source Root" but it still didn't work.

    Thanks everyone for your suggestions so far.

    I've attached snapshots of my Main and MainWindow files. As for @onnwards' suggestion, I tried implementing the direct path but the two lines remain red.

    MainWindow

    Main

    I restarted the entire JavaFX process and it managed to work, so I'm guessing something went wrong somewhere in between but I'm still unable to figure out exactly what. Anyway, thanks everyone so much for your suggestions!

    @damithc, since this seems to be a module-wide behaviour.

    The change

    Our group recently refactored our tP documentation structure in a series of commits '4df1103'...'73947a7'.

    Essentially we changed the hierarchy of documents from:

    '''

    docs

    +-- DeveloperGuide.md

    +-- Configuration.md

    +-- ...

    +-- UserGuide.md

    '''

    to the following, to abstract content away from the structure of the developer guide:

    '''

    docs

    +-- developer

    | +-- Configuration.md

    | +-- ...

    +-- developerGuide

    | +-- architecture

    | | +-- Logic.md

    | | +-- ...

    | +-- feature

    | | +-- Add.md

    | | +-- ...

    | +-- ...

    +-- DeveloperGuide.md

    +-- UserGuide.md

    '''

    Sample code snippet of 'DeveloperGuide.md' after refactoring:

    '''

    Architecture

    {% include_relative developerGuide/architecture/index.md %}'

    The sections below give more details of each component.

    {% include_relative developerGuide/architecture/Ui.md %}

    {% include_relative developerGuide/architecture/Logic.md %}

    '''

    The problem

    This had the unintended effect of removing the progress check marks on the dashboard for group members, since the grading scripts seem to only capture changes and regenerates statistics only based on the git blame of specific files '/docs/developerGuide.md' and '/docs/UserGuide.md' in the latest commit of the 'master' branch:

    Sample 1:

    Sample 2:

    Proposed fixes

    Would it be possible to add an exception to the grading scripts for progress prior to week 12 to track based on the commit '3ef2209' immediately before the refactoring? Otherwise what would be the recommended next step forward?

    Any help rendered would be greatly appreciated. Thank you!

    Some observations I gathered while doing the Week 4 tasks:

    1. Setup instructions for Gradle requires deleting .idea folder and reopening the project (or invalidating caches as suggested by SO)

    2. Project opening time is noticeably longer after Gradle is integrated, with the pop-up mentioning something about indexing project files

    3. JavaFX libraries are automatically installed upon addition of dependencies into build.gradle and restart of IntelliJ IDE

    My guess is IntelliJ somehow caches project information inside the .idea folder, which includes commands to load Gradle and its configuration files upon opening the project. Could someone perhaps point me to resources to find out more? 😃

    The fact that the IDE automatically does dependency checking and library installation without the user initiating these operations sounds a little intrusive 😢 Or maybe I'm too used to a simple text editor environment.

    I have a perennial fear of missing todos 😂

    Feel free to regenerate this list with this mini script, when more quizzes come in.

    Requirements: Python 3 + BeautifulSoup4.

    edit: Update links + Made the search for header text a little more robust.


    Last updated: 2021-03-25

    Week 1

    Week 2

    Week 3

    [W3.4] Code Quality: Coding Standards  | Implementation → Code Quality → Introduction → What

    [W3.4] Code Quality: Coding Standards  | Implementation → Code Quality → Style → Introduction

    [W3.5] Developer Testing  | Quality Assurance → Testing → Developer Testing → Why

    [W3.6] Unit Testing

    Week 4

    [W4.2] Class/Object Diagrams: Basics

    [W4.3] Class Diagrams: Intermediate-Level

    Week 5

    [W5.3] Requirements: Specifying

    [W5.4] Code Quality  | Readability

    [W5.4] Code Quality  | Code Comments

    Week 6

    [W6.1] Modeling: Sequence Diagrams  | Design → Modelling → Modelling Behaviors Sequence diagrams - basic

    [W6.1] Modeling: Sequence Diagrams  | Design → Modelling → Modelling Behaviors Sequence diagrams - intermediate

    Week 7

    [W7.1] Requirements: Use Cases

    [W7.3] Design: Fundamentals

    [W7.7] Project Mgt: Workflows

    Week 8

    Week 8 [Fri, Mar 5th] - Topics

    [W8.4] Testing: Types  | Quality Assurance → Testing → Acceptance Testing → Acceptance versus system testing

    Week 9

    [W9.1] OO Domain Models

    [W9.2] Activity Diagrams

    [W9.5] Design Principles  | Principles → Law of Demeter

    Week 10

    [W10.1] Design Patterns  | Introduction

    [W10.2] Defensive Programming

    [W10.4] Test Cases: Equivalence Partitioning  | Quality Assurance → Test Case Design → Equivalence Partitions → Basic

    [W10.5] Test Cases: Boundary Value Analysis  | Quality Assurance → Test Case Design → Boundary Value Analysis → How

    Week 11

    [W11.1] More Design Patterns  | Design → Design Patterns → Observer Pattern → What

    [W11.3] Test Cases: Combining Multiple Inputs

    Week 12

    Week 13

    You can continue the conversation thread by going back to the pull request and throwing in a follow up comment in the thread. Alternatively, you might be able to edit your pull request comment on the same page, and selecting Edit; see below.

    Great tip, thanks!

    Same problem occurred to me as well, after specifying the JavaFX dependencies in build.gradle.

    You could try this sequence of steps: closing the project, deleting the .idea folder (or alternatively selecting Invalidate Cache) and then reopening it again and let Gradle/IDE rebuild these files.

    I'm assuming you're using IntelliJ here?

    Jumping on the bandwagon 😃

    If dealing with images is too troublesome, can consider not using them at all. Went for a multi-monitor look-and-feel with an 'always-on' list, so that I can lower stress levels leaving list out between every command. The past commands are made clickable to make correcting wrong commands easier, by adding an onMouseClicked event to the individual boxes.

    Me too.

    Handy tool, have been using Snipping Tool for a long time now 👍🏻

    Since we're on this topic, if you're willing to spend a small amount of time overriding the PrintScreen button, I highly recommend Greenshot for Windows users to replace the default screen capture tool.

    >br>

    1. Gives you pixel-accurate screenshot abilities:

    >br>

    1. You can pipe the screenshot to any combination of these preset consumers:

    >br>

    1. And even customize the output filename - it's strongly integrated within my notetaking / documentation workflow (edit: swapped out the image for a more familiar use case):

    Hello,

    Basically, I'm trying to complete the testing stage of Tuturial 3 and I can't pass this last test case.

    I followed the instructions closely and am currently this issue:

    Delving into this test case, I see that the error lies in the code here:

    Basically, it's testing that the same name with different attributes should still be considered the "same person". (Refer to last highlighted line (assertTrue....)

    So what I tried to do is to go to Person.java's isSamePerson() and edit it as such:

    However, if I edit it as such and run the testing again, I get faced with another test case that fails. (below)

    I've tried to solve this particular test case error but was not successful. (Refer below)

    Has anyone faced a similar issue with these two related test cases?

    Thanks in advance!

    Hello,

    I am a mac user and I am trying to verify that my jar file runs cross-platform. It seems to work on mac and linux but it is throwing error on windows platform.

    I tried to google the issue but I can't really get definitive answers, but some are saying its pointing to the discrepancy between Java runtime environment versions.

    For reference, this is the error that appears when attempted to run on Windows through CLI.

    Screenshot 2021-02-16 at 10 30 20 AM

    Thanks in advance!

    Hello,

    So I followed the instructions of this week's IP closely and I am pretty sure I did not make any mistakes.

    However, after I was done with branch-A-Assertions and branch-A-CodeQuality, my Git tree looks quite messed up.

    Basically, it seems that branch-A-Assertions is branching out of my branch-A-CodeQuality which is not even possible because I did it stepwise.

    Can someone tell me if I messed up?

    Screenshot 2021-02-09 at 6 19 14 PM

    Hi all,

    I am currently trying to adhere to the Java coding standard by using checkstyle. However, after downloading it from the official checkstyle website (version 8.40), I am unsure of which checkstyle file to actually use in my .config/checkstyle, as seen from the screen shot below.

    Am I doing something wrong or are we supposed to use a provided checkstyle.xml file somewhere?

    Thanks in advance!

    Screenshot 2021-02-01 at 1 49 50 PM

    Ok thank you Soon Keat and Prof!

    But that is unlikely because I did branch-A-CodeQuality last. I'm quite certain I did branch-A-Assertions > checkout to master > branch-A-CodeQuality.

    Yes, I'm on branch master currently.

    Thank you all for the help!

    It managed to work when tested on other Windows machines, probably the error was thrown due to outdated java runtime environment.

    Thank you so much! This solved my issue!

    [Question requirements] Save the tasks in the hard disk automatically whenever the task list changes. Load the data from the hard disk when Duke starts up. You may hard-code the file name and location e.g., [project_root]/data/duke.txt

    Hi all, how do we save the tasklist data, do we just

    1. Save once for a single duke session initiate>>manipulate>>terminate

    E.g User initiate session, adds stuff but terminate prematurely, any task added would not be saved to hard disk.

    2, In a single duke session, save multiple times for every manipulation[add, delete],

    Hi, I am getting "checkstyle rule violations were found" error message

    I have placed config file on the same level as src and ensure the build gradle file has 8.29 included

    Could you advise on how to resolve this error thanks

    Screenshot 2021-02-03 232910

    I am running through the Gradle menu on the top right, the "checkstyleMain"

    I just tried gradle checkstyleMain checkstyleTest but same error message

    Screenshot 202s

    I followed the JavaFX tutorial part and run launcher, I encountered this error message,

    Caused by: java.lang.NoSuchMethodException: duke.Duke.()

    already added the stated dependencies to build gradle

    added javafx import statements in Duke and start (Stage stage) method

    Could I have advice on how to handle this error message?

    launcher

    yes it works after I resolve the code violations, thanks

    I shifted my main method from Duke class to Main class

    But the error is still the same, Caused by: java.lang.NoSuchMethodException: duke.Duke.init

    Tried googling abt this but cant find any solutions

    Shld I only have 1 main method?

    1 2

    ohh previously it was like this[image below], I think I misunderstood your hint as separating main method from Duke class, so I create a Main class

    [Is your Duke class taking in any arguments? If it is you might want to refactor it to not take in any 😃]

    should I be writing duke.init() method but isn't it running in the background?

    3

    Changed to Main extends Application instead of Duke and it works thanks!

    For instance, in one of the tutorials, we had a remark field that need not be present.

    So let's compare the following:

    
    Person (Name name, Phone phone, Address address, Remark remark) {
    
    }
    
    

    or

    
    Person (Name name, Phone phone, Address address, Optional<remark> remark) {
    
    }
    
    

    My friends and I were discussing that if we were to consider a UML diagram, the multiplicity of remark should be 0 to 1.

    However, if we do not specify a remark, the method would fill it in with an empty string "", but yet still creating a Remark object.

    Also, we should not be passing in a NULL as it is generally a bad idea.

    So the question remains, which is the better way to pass a remark into the person constructor?

    The notion of writing good code is to write readable code, and both streams and loops can do the same job.

    While some might be more familiar with the functional paradigm, others may be more comfortable with the standard loops.

    Hence my question:

    Are streams more or less readable than their for/while loop counterparts?

    In other words, should I be writing more streams when I could? or rather avoid streams and stick to using loops?

    demo

    @Cheng20010201

    You could check out the module's policy on reuse here!

    https://nus-cs2103-ay2021s2.github.io/website/admin/appendixB-policies.html#policy-reuse

    For myself, I tagged A-Streams and A-Lambdas in the same commit, within the branch called branch-A-Lambdas. It kind of makes sense to me to do so because it's only natural to use lambdas with your streams.

    Thanks, @SoonKeatNeo for your insights 👍 Although I am comfortable with using both, I do agree with what you mentioned that preference of one over the other is subjective.

    I believe @rajobasu is somewhat right in the sense that it is about writing lesser code, and could lead to easier to manage code. Along with @Cheng20010201 who mentions that streams could be used for parallelizing and processing a large dataset.

    I guess it really depends on the use then, perhaps the conventional for loops for simple functions, and streams when I know I have to handle a large amount of data.

    But I was wondering from the industry standpoint, would software engineers tend to be more comfortable with loops or streams? Is there some kind of industry preference out there if any of you guys have an internship experience.

    @vevek I am sort of facing the same problem as you are (i am a mac user too and double-clicking on the jar file doesn't launch it). One workaround I found apart from launching from the command line is to right-click > open with > JavaLauncher.

    Perhaps that might work for you as well!

    @CSmortal could you clarify with an example?

    did you mean something like:

    
    public Fruit parseCommand(String command) throws CommandNotFoundException {
    
        switch (command) {
    
        case "apple":
    
            return new Apple();
    
        case "banana":
    
            return new Banana();
    
        default:
    
            throw new CommandNotFoundException();
    
        }
    
    }
    
    

    versus

    
    public Fruit parseCommand(String command) {
    
        switch (command) {
    
        case "apple":
    
            return new Apple();
    
        case "banana":
    
            return new Banana();
    
        default:
    
            return null;
    
            // return a null here instead of throwing an exception
    
        }
    
    }
    
    

    Also, I found this somewhat relevant, and perhaps linked to the use of enums.

    I've been using some JavaFX Alerts in my code and the problem is that sometimes when I switch windows while the Alert is displayed, the Java application just suddenly crashes without me nor the Java application doing anything in the meantime.

    It wouldn't crash if I stay on the application even with an indefinite amount of time. So I'm pretty confident it's not a coding issue, and I found out that it's supposedly it's a system issue on MacOS Mojave on window switching.

    Screen Shot 2021-03-28 at 1 36 37 AM

    This is what I get on IntelliJ after the crash.

    So my question is: would this be counted as a bug in the application if this kind of problem occurs during the PE?

    I think it may have to do with System.lineSeparator() as line separators differ from operating system to operating system. You should be able to toggle the lineSeparator in IntelliJ on the bottom tool bar from a label that says either LF/CR/CRLF. But it might be better to not use System.lineSeparator().

    This post might help.

    From my understanding, the finally block is used for resource releasing. As in although Java has a garbage collector, there are still some classes/objects you'll have to manually close, such as files. So if you opened a file in a try block, you'll have close it in the finally block, because the finally block would execute regardless.

    I think this link would help:

    https://docs.oracle.com/javase/tutorial/essential/exceptions/finally.html

    Maybe write a toString() method and assert the strings instead?

    Remember to change the class name when you do the switch from Text UI to GUI, considering that the main class should be different.

    Some checkstyle files have syntax errors or version incompatibility, not sure which. But most of them are issues with TreeWalker. Edit the xml file and move the modules in the warnings out of TreeWalker one by one.

    Like for this screenshot, you'll want to move the entire FileContentsHolder module out of TreeWalker.

    Just move them warning by warning. I don't think there are that many of them.

    Personally, I feel that if the chaining of stream methods are properly line skipped looks cleaner as compared to loops as loops increase indentation levels and as the indentation levels goes up, the code becomes more unreadable. So for me, I use streams to replace small loops in order to increase code readability.

    Okay thanks professor!

    Can Activity Diagrams have multiple end nodes?

    These folks say yes: https://softwareengineering.stackexchange.com/a/215137

    However, the textbook neither explicitly says we can, nor does it say we cannot. Does anyone have any ideas?

    If the "Run with coverage" option is greyed out for you, as seen below, you can try this:

    Run with coverage icon is greyed out in bar on the top right

    Option grayed out in Run tab too.

    What you can try:

    Under preferences, click on Plugins, and then select "Installed":

    Ensure that "Code coverage for Java" is enabled

    While the link provided by the textbook is helpful, in Intellij 2020 the "VM Options" field is missing. Thus to enable assertions you need to do one more thing:

    Under modify options on the right, click "Add VM Options", then add the -ea argument. Hope this helps anyone who was looking for VM Options.

    Prof @damithc, In line with this, can we use Maven to manage the dependencies?

    Perhaps I am misunderstanding something, allow me to clarify my thought process:

    As Jackson is a 3rd party dependency, there are 2 ways to manage it.

    • we can add it to the classpath manually

    • we can use a package manager to manage our dependencies

    From my understanding, Gradle is meant for build automation, but Maven is meant to do dependency management (Perhaps I am wrong about this)

    With that reasoning in mind, I asked if we should use Maven to manage Jackson, so that version updates etc can be quickly and easily taken care of by updating the pom.xml file. However, if Gradle can do this as well, then it would make more sense to use Gradle as the project is already intending to use it down the road.

    Do let me know if this makes sense 😅

    Understood, will figure out how to manage Jackson through Gradle.

    Thank you Prof!

    Np!

    Personally, I think it's fine for "Automated UI Testing", but maybe you still can give more detailed information (e.g. what update did you make) after the same commit name.

    I have the same message as yours in the debug console, but I got another pop up window after a few seconds showing all the debugging message. Also, I have the "Main.main()" tab, so I guess maybe you should check whether you set the configuration (the drop down list next to "Run") or not.

    image

    I agree the quote from you, and I think that is the main reason to use interfaces. As for "why not use abstract class?", I think the need for abstract class (on top of interface) is just for us to define some functions that are the same in its child class, so as to reduce repetition. Other than that, a class can implement multiple interfaces, which gives us more flexibility, while a class cannot extend multiple abstract classes.

    Also remember to change all the json files associated with the tests:))

    What I can think of is something like the example in Week 8 Topics. If two class they are partners of each other, no one is superior than the other. In that case, both of them should maintain a reference to each other and thus have a bi-directional association. This is just my point of view, correct me if I'm wrong.

    1. I think it's just for better abstraction purpose.

    2. I think the exclusion of getUserPrefsFilePath() from Storage interface is a mistake, as getAddressFilePath() is included in Storage interface. But anyways, StorageManager will still inherit that method from grandparent interface, so it's fine.

    Even if we remove Storage interface completely, the code will still work fine, since Storage didn't add any new signatures. Hence, I think the existence of that is just to achieve better architecture design and abstraction:))

    By the way, I also found AB3 diagram doesn't show the inheritance of Storage from UserPrefsStorage and AddressBookStorage, so maybe they intended to let StorageManager to inherit directly from UserPrefsStorage and AddressBookStorage at first.

    Hi Prof,

    I was testing using git CLI to commit and did not follow the convention for a few of my commits locally. I've since changed to follow the conventions for subsequent commits, is that ok or do I have to update the commit messages and redo them?

    Ok thanks prof!!

    Oh sorry my bad ! 😅 @richardcom

    also to add on, if you want to use | as a delimiter for your stored inputs. You should use "\|" as the regex pattern. I wasted so much time debugging cause of this.

    remember to close the issue if the problem is solved

    My team and I are facing the same issue too.

    Screen Shot 2021-04-01 at 9 21 21 PM

    Hi all,

    May I ask what should we do to pass the team CI?

    Since we already has the gradle.yml file in .github/workflows

    Thanks a lot in advance!

    Hi all,

    I've been trying to jar the project for quite a while but got stuck at this error.

    While my project directory and the file path is like this

    What I did with Storage class is

    public Storage(String filepath) {

        this.file = new File(filepath);
    
        FileReader fr;
    
        try {
    
            file.createNewFile();
    
     ...
    

    Can someone please help, what is wrong with my jar?

    I guess there is something wrong with my file path, but I could not figure out why. I followed the steps of creating java jar in the tutorial given in A-Jar segment.

    Thx a lot in advance!

    Hi all,

    May I ask how the issue page is supposed to look like after a few commits and tags pushed to origin..

    What I have done are:

    1. git add .

    2. git commit -m "level x"

    3. git push

    4. git tag "level x"

    5. git push origin --tags

    But inside the page https://github.com/myusename/ip/issues url, it shows 'Welcome to Issues!' without my previous taggings and all.

    Is it supposed to look like this?

    Thanks in advance!

    From the file path and where you’re running the JAR from, I think the relative path there would imply that your duke.txt file is in: ...\Java\compileroutput\artifacts\ip_jar\src\data\duke.txt, which I guess is not what you have set up? You can verify this if you create the src\data directory in ip_jar folder.

    Hi thx!

    I don't have a ip_jar\src folder at all, I just went to check the jar structure and it looks like this

    ip.jar

    ->data

    ->->duke.txt

    ->main

    ->->java

    ->->->...all classes etc

    ->META-INF

    btw, may i clarify what do you mean by create the src\data directory in ip_jar folder?

    Thx again!

    Thx a lot for the help guys!

    Yes it solved the issue for me!

    @danadi7 thx for the reminder!

    Hi prof,

    Yes, the link to our team repo is https://github.com/AY2021S2-CS2103T-W13-2/tp

    Previously re-cloned my own tp project, but after that I encountered these problems. The import statements are appearing red and so are the classes in the code as well as their respective methods, even though they exist. I keep getting the 'Cannot resolve symbol 'xx'' error. Would appreciate any help, thank you in advance!

    When I use "gradlew test" to run the JUnit tests in my iP, everything works fine. However if I right click the test folder and click on "Run 'All Tests'", a lot of errors come up (in all the classes where I imported javafx). Is there something wrong and will this affect the grading?

    After I finished the tutorial for the remark command, I tried to ran the tests again but a lot of them failed and I'm not sure why, since I did not modify tests in other test classes except for RemarkCommandTest. In the picture below there's an error for the equals method in RemarkCommandTest, but looking at the code it doesn't make sense as both objects are the same. I tried to run the debugger and the error "Cannot find local variable 'addressBookFromFile'" comes up, but I can't seem to find which local variable it is referencing to in the RemarkCommandTest method. If anyone could help it would be greatly appreciated!

    That's odd! I tried deleting the .idea and then tried to run the tests with both 'gradlew test' and right clicking "Run 'All Tests'", and both methods had all test cases pass, so I'm not sure why it's failing on yours.

    testsuccess

    However after I did this, I can only run my jar file by 'gradlew run' and not when I right click "run" on my Launcher class...

    Hmm I checked and all my commits are already pushed. I tried importing the project again after cloning and both launching & the tests work now! I suppose it was something wrong with the IntelliJ configuration. Thanks so much for your help!

    Thank you so much, that was the problem!

    Thank you so much, that solved the problem!

    For some reason, by Java CI keeps failing (build ubuntu-latest). This is even though for the developer guide, it is literally newline spaces that are present throughout the document, and it doesn't make sense for there to be newlines in the iml file (or else the entire iml file should have newlines).

    Not sure if its related but the checkstyle has no errors as well.

    Any helps?

    For some reason, my Intellij doesn't seem to work, and gives me a ton of error, yet when I run the Gradle script, it seems to work fine. For example, when this is my start method in my Main class as per the JavaFX tutorial (exactly the same). This seems to somehow pop up out of nowhere because I'm sure my IDE could run a few days ago...

    
    @Override
    
        public void start(Stage stage) {
    
            try {
    
                FXMLLoader fxmlLoader = new FXMLLoader(Main.class.getResource("/view/MainWindow.fxml"));
    
                AnchorPane ap = fxmlLoader.load();
    
                Scene scene = new Scene(ap);
    
                stage.setScene(scene);
    
                fxmlLoader.<MainWindow>getController().setDuke(duke);
    
                stage.show();
    
            } catch (IOException e) {
    
                e.printStackTrace();
    
            }
    
        }
    
    }
    
    

    yet it shows this error:

    
    Exception in Application start method
    
    Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
    
    	at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:973)
    
    	at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:198)
    
    	at java.base/java.lang.Thread.run(Thread.java:834)
    
    Caused by: java.lang.IllegalStateException: Location is not set.
    
    	at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2459)
    
    	at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2435)
    
    	at Main.start(Main.java:16)
    
    	at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:919)
    
    	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$11(PlatformImpl.java:449)
    
    	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$9(PlatformImpl.java:418)
    
    	at java.base/java.security.AccessController.doPrivileged(Native Method)
    
    	at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:417)
    
    	at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    
    	at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    
    	at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:175)
    
    	... 1 more
    
    

    But when I built and run with gradle --> Tasks/build/build ,ip [run], it works fine! The JAR file created with the Gradle works too. Another thing is the testcases, I would get this error:

    
    Exception in thread "main" java.lang.NoClassDefFoundError: org/junit/platform/launcher/TestExecutionListener
    
    	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    
    	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
    
    	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
    
    	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
    
    	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
    
    	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
    
    	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
    
    	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    
    	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    
    	at com.intellij.junit5.JUnit5IdeaTestRunner.createListeners(JUnit5IdeaTestRunner.java:39)
    
    	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:31)
    
    	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
    
    	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
    
    Caused by: java.lang.ClassNotFoundException: org.junit.platform.launcher.TestExecutionListener
    
    	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
    
    	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    
    	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    
    	... 13 more
    
    

    But once again, running Gradle's verficiation/test works and passes my testcase just fine.

    Is this a cause for concern, because my code is literally the same and yet these error that are not present before are here suddenly.

    Yes, I'm using Gradle as the default for both build and run and run tests.

    Yes! my mainClassName is "Launcher", and I've been trying to run using the Launcher main() method haha

    What I'm confused is that the error says Location is not set, and yes when I tried to System.out.println(Main.class.getResource("/view/MainWindow.fxml")) I get a null, and hence I'm really confused since Gradle should be using the same code (and the tutorial literally works before with the same code) and yet for some reason my IDE is popping up all these errors now haha

    oh my god. What the... IT WORKS

    Thank you so much sir...

    But actually what does marking the folder as Resource Root does ah out of curiousity? And why can Gradle run it fine, but the IDE doesnt seem to know it's a resource folder?

    Also really ,thanks, but my tests are still goners though... This is my screenshot of my folder structure just in case I didn't mark it again...

    Hmm, doesn't seem to be working though... But it's alright for now I guess. I'll fix the testcase bugs in the future, and focus on this weeks iP levels now that I can run properly on my IDE at least. Thank you so much!!

    Ok for some reason, deleting my iml files fixed everything haha

    Thanks for the help regardless!

    I was confused about the errors listed above because it made no sense to me (the developer guide had trailing white spaces throughout the entire file for example, which are needed as they are used for formatting -- leaving newlines etc), but I'm glad it was solved!

    Good day,

    I'm trying to do Level-10: GUI.

    I have followed the JavaFX tutorial for both my actual DukeBot and a dummy one that uses a DukeBot stub, as recommended by the Week 4 Project page.

    In both of these projects, whenever I use the command ./gradlew run I get the following error:

    However, in the dummy project where a stub of DukeBot was setup to support the JavaFX classes given in the tutorial, running the Launcher via Intellij works fine. (Running my full DukeBot via Intellij gives an error which I suspect might be unrelated).

    Notes:

    1. I looked at the forum post about getting Intellij to build and run using Gradle and have confirmed that my Intellij settings are the same as in the post. So it surprises my that running via Intellij works whereas running via ./gradlew run does not.

    2. I have updated my build.gradle to set the main class as the Launcher.java.

    3. I have pushed both projects to github repositories so that anyone whos interested can recreate the error:

    Hi, I'm trying to do A-Gradle and I keep encountering the following problem.

    
    Unable to create Root Module: config {/mnt/d/OneDrive/Desktop/NUS Work/Y3S2/CS2103/ip/config/checkstyle/checkstyle.xml}, classpath {/mnt/d/OneDrive/Desktop/NUS Work/Y3S2/CS2103/ip/build/classes/java/main:/mnt/d/OneDrive/D
    
    esktop/NUS Work/Y3S2/CS2103/ip/build/resources/main}.
    
    

    If i run ./gradlew run my iP works fine and can be interacted with, however ./gradlew build always fails and gives the above error.

    I have searched online forums and also tried debugging my build.gradle file by using println statements, everything seems to be working fine but the error keeps appearing.

    I have also compared my build.gradle against a friends whose one works and it seems to match, only differing in our file names.

    I am using WSL2 and IntelliJ.

    Does anyone know how to fix the above issue?

    By not being able to build the project via Gradle I cannot complete A-Gradle and every subsequent task that relies on Gradle.

    Notes:

    1. I got the checkstyle.xml and supressions.xml from the AB-3 Github page

    2. The above xml files are in the correct directory (ip/config/checkstyle)

    3. The following code in build.gradle correctly points to the directory mentioned in point 2. I checked using a println statement.

    
    checkstyle {
    
        toolVersion = '8.29'
    
        configFile = rootProject.file("${rootDir}/config/checkstyle/checkstyle.xml")
    
    }
    
    

    In the article: Three pillars of Unit Tests by the Aspire Blog Team the claim was made that needing to test private methods is "a sign of a bad design".

    However, in the articles comments section people strongly disagreed with this, while others argued for it.

    Could I check what the recommendation is for CS2103 when it comes to Private methods.

    Hi @tjtanjin, thanks for the quick response.

    In line with your suggestions I have attempted the following:

    1. I removed the line in gradle.build containing configFile = ... however the same error occured.

    2. I've looked through the guide you uploaded on the CS2103 forum and I'm pretty sure my steps matched those in the guide when I was setting up Gradle.

    3. I've pushed my current version to a branch in my repo called fix-gradle-unable-to-create-root-module for any kind person whos willing to take a look.

    That solved the problem! Thank you so much for the help, really glad to be able to move past this level.

    Thank you for the help @tjtanjin, setting fx:controller="dbot.gui.controller.MainWindow" resolved the build and run via Intellij issue.

    Is there any guideline to do automated testing for UI components?

    Any help will be very helpful!

    Currently, my team split our features randomly. However, my friend who took CS2103 last year told me to split it based on the part of the application (logic, UI, storage, etc). Which one is better?

    I failed automated smoke testing of my final jar file for IP. I have tried the jar file on my friend's laptop and it worked. I am using Java version 11 and IntelliJ 2020.1.3 on my local computer.

    The error sent from the automated test:

    • On Windows, using Java 11, for the duke.jar uploaded on 02-22-2021 (MM-DD-YYYY) at 21:47:45:

    Error: LinkageError occurred while loading main class Launcher java.lang.UnsupportedClassVersionError: Launcher has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 55.0

    • On Linux, using Java 11, for the duke.jar uploaded on 02-22-2021 (MM-DD-YYYY) at 21:47:45:

    Error: LinkageError occurred while loading main class Launcher java.lang.UnsupportedClassVersionError: Launcher has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 55.0

    • On Mac, using Java 11, for the duke.jar uploaded on 02-22-2021 (MM-DD-YYYY) at 21:47:45:

    Error: LinkageError occurred while loading main class Launcher java.lang.UnsupportedClassVersionError: Launcher has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 55.0

    Could you share what was the problem that the automated smoke test was finding? That might make it easier to narrow the issue down.

    this issue seems to be similar to yours, can try and see if the solution provided by @tjtanjin works for you!

    Thanks!

    Thank you for the tip!

    After I clone tp and open the project in Intellij, the command.java file cannot be opened

    When I try to open the file, it shows "Decompiled .class file"

    It does not affect the program as I can still run the program without issue.

    I can also view the file using another editor, and on github.

    May I know what I can do to display the code for the class?

    Screenshot 2021-02-17 at 11 57 04 AM Screenshot 2021-02-17 at 11 57 44 AM
    Screenshot 2021-02-17 at 12 29 41 PM

    After the welcome page, I chose "open" to open the tp folder from my desktop.

    Screenshot 2021-02-17 at 12 30 24 PM

    I have already done that. The issue persisted. I have also redownloaded the Intellij application, did not fix the issue either.

    I tried to delete the file and create a new one. But as long as the class name is "Command", it will automatically become a decompiled .class file.

    I can open the file using VScode though.

    Yes, I am able to proceed but there are a lot red underlines indicating errors. But the program is able to run nonetheless. Thanks prof, will wait to see how it goes.

    Solved by deleting the file name patterns for the java class file type

    Hi, just yesterday, I noticed that our group's PR stopped showing the codecov coverage report.

    Can I check what could be the cause of this and is there anyway to include the codecov coverage report back again?

    Thank you!

    Hi. In this week's tp, one of the task we are required to do is to "Update the link of the GitHub Actions build status badge (Build Status) so that it reflects the build status of your team repo.". However, I tried to go to the Actions page and tried google searching but then I am still unsure of what actions are required for this task.

    Please advise.

    Thank you.

    While trying to follow the steps to run checkstyle, I ran into this error.

    Anyone know whats wrong?

    Ok thank you prof. I didn't realize that we had to download and put the folders in the exact place with gradle. Thank you.

    Ahhh! I didn't click on the right submenu button that leads to the "Create status badge" functionality!

    Thank you so much!

    Hi prof @damithc, the issue is on our group's PR such as https://github.com/AY2021S2-CS2103T-T11-1/tp/pull/166. Do understand that codecov reports are not used, but then its something nice for us to have since, it tells us how much coverage we would have increase with our test cases. So not sure if there is anything we can do to enable it back.

    Hello there!

    For my team's tP, we're implementing some feature that uses mailto links. These links would invoke the user's OS default mail client (e.g., Outlook, Thunderbird, etc.) to send an email, which is technically using external software. In case the user does not have a default mail client assigned, the user's web browser opens an empty new window.

    However, neither does the application require a particular mail client to be installed in the OS, nor does it require the use of third-party Java libraries.

    Is it okay to have the aforementioned behaviour in our application? More specifically, does it violate the Constraint-External-Software constraint?

    Hello everyone!

    Just wanted to highlight a possible typo while I was reading the CS2103/T online textbook.

    In the Polymorphism section of the Supplementary: C++ to Java chapter, the Cat and Dog classes in the PetShelter example seem to miss the extends keyword.

    While it is a small typo, the Java file will not compile due to the calls of the super constructor in both classes.

    Thank you.

    My pleasure, Prof. @damithc!

    Yes. I believe it is the same case for Dog class too.

    In that case I think those two classes are not supposed to have extends Animal as this code is supposed to illustrate the situation before applying polymorphism? Or did I misunderstand your bug report?

    Oh right, it could be. But if that was the case, then the super calls in the constructors of Cat and Dog would raise a compile-time error when trying to compile these classes.

    Okay 👍

    Thanks prof @damithc !

    My team and I are facing a similar issue as well.

    Hi Prof @damithc the check for macos is not loading (10mins in and it had not started), I refreshed twice and the issue still exists. The build is not starting though it is queued.

    About the weekly report, I have already made quite a few PRs/commit to the team repo master, but the team progress dashboard isn't updated. Am I missing out on some steps to be detected?

    Hi, run into this problem where my pull request did not get updated correctly(The first photo is my current ip). Furthermore, when I close the previous pull request and try to make a new one, it shows the one to be uploaded is the one that was done 2 weeks ago(as seen in the second photo).

    I've tried to follow the instruction and create a new module test from an existing source. But somehow I still having trouble importing duke. Duke. There is no dependencies tab for the test module and when I add reference of Duke in DukeTest, the hint has suggested moving duke. Duke into test/java/duke instead of creating dependencies. Did I miss out on some steps in the instructions or is there something wrong with my setup in the IntelliJ.

    You might want to try unmarking your src folder as Sources Root and then marking the java folder within your main folder as Sources Root first. Then, check if the directory structure in your java file in the main folder mirrors that of the java file inside your test folder. You shouldn't have to explicitly import Duke in your test class. Use Duke in the test class as you would normally in the main class and a prompt would pop up for you again to rectify the error. See if any of the above helps 😄

    thank you so much! Manage to solve the issue.

    @Hzxin Hi, I have just checked ur closed pr. It seems that it was updated and your commits(e.g. resolve conflicts for level 9) on Jan 30th are shown.

    I think I saw it wrongly, my bad

    @damithc Problem has been resolved Thank you for the explanation

    When we refactor code based on SLAP, do we catch and immediately throw an Exception? For example,

    
    public void method() throws SomeException {
    
      if (isBadOutcome) {
    
        throw new SomeException();
    
      }
    
      
    
      ...
    
    }
    
    

    Is it okay to refactor this to

    
    public void method() throws SomeException {
    
      try {
    
        handleBadOutcome(isBadOutcome);
    
      } catch (SomeException se) {
    
        throw se;
    
      }
    
      ...
    
    }
    
    
    
    private void handleBadOutcome(boolean isBadOutcome) throws SomeException {
    
      if (isBadOutcome) {
    
        throw new SomeException();
    
      }
    
    }
    
    

    Not sure if immediately rethrowing Exceptions is a good practice. Thanks!

    Correct me if I'm wrong: even when returning or printing strings for an error message e.g return "Oops, the program encountered some error and this is the error message."; this is considered a magic literal and should be replaced with return ERROR_MESSAGE_SPECIFICATION;

    However, I'm not sure if we just want to return something like return "added: " + eventAdded + " to some list."; is this considered magic literal and affecting the code quality?

    Does anyone know what is the purpose of this java folder?

    Also, will there be any issues if I move the build.gradle, settings.gradle, .gitignore, gradlew, etc. files into a config folder? Thank you:)

    If foo is aware of goo and goo is aware of bar, then is foo aware of bar?

    And is there a difference if the navigability is bidirectional, i.e student aware of teacher and teacher aware of student, then can a student object be aware of another student object?

    Got it thanks!

    Thanks @tlylt @kouyk @damithc for the insights! Here is a quick summary (or at least my understanding, feel free to correct me!) based on the advice above: it seems that if the type of the Exception changes due to the difference in level of abstraction, it would be best for the code at a higher level of abstraction to catch and transform the Exception to an appropriate one that matches the current level of exception. Whereas, if the level of abstraction is the same (or the type of exception is the same) the code does not need to catch the exception and the Exception will automatically be handled.

    In addition, the stack trace will still be preserved when you

    a. Transform the exception, or

    b. let the method automatically handle the exception e.g

    
    public void method() throws SomeException {
    
        handleBadOutcome(isBadOutcome);    // Note the lack of the try and catch block here.
    
        ...
    
    }
    
    
    
    private void handleBadOutcome(boolean isBadOutcome) throws SomeException {
    
        if (isBadOutcome) {
    
            throw new SomeException();
    
        }
    
    }
    
    

    I was reviewing the mistakes from my previous quizzes and I was confused as to why [i = 1 to 5] is an incorrect way to show a for-loop, and what would be a correct way to show a for-loop.

    Screenshot 2021-02-22 at 1 21 45 PM

    for my storage class, it loads the data file from memory directly and then returned the taskList from the data and so I use taskList = storage.load();.

    I think line 2, storage.load(taskList); works by first loading the dataList onto an arrayList, perhaps by using another class like parser, and then storage.load(taskList) loads the taskList into duke's tasklist.

    I think that the first way is more convenient, but both ways are valid and your implementation depends on your definition of storage, i.e is storage suppose to load the data from memory into duke or is storage loading the data already in duke to its tasklist.

    Screenshot 2021-02-06 at 4 48 49 PM

    My UI uses a picture of a crying cat when the user's input results in an error in Duke and a smiling cat when the user's input is able to be processed.

    Oh I see! >_>

    I think that the use of the draft pull request feature can really be helpful for my team because it could reduce instances where we would have to review large chunks of code in one go when there is a large pull request. Thanks for informing everyone on such an enlightening feature!

    I think that

    'Class A {

    void doStuff(B b) {

       b.doCStuff();
    

    }

    }

    Class B {

    C c;

    void doCStuff() {

      getC().doCStuff();
    

    }

    }'

    really is worth the effort in refactoring, because it can really help cut down on possible bugs and mistakes that are likely to arise when you add more code to class A's doStuff() method. Also, having getters that gets class C can make any changes to class C or B especially tedious in the long run, which strengthens the case for refactoring.

    I think that it might not always be applicable to do

    'Class A {

    void doStuff(C c) {

       c.doCStuff();
    

    }

    }'

    For instance, A can be personListManager and B can be a person and C can be the person's name. It does not really make sense for A to directly call c.doCStuff, as it may only be managing B (that contains C), and can also become an unnecessary association that can make the code overly complicated in the long run.

    Regarding CI, code coverage, I looked at this guide: https://nus-cs2103-ay2021s2.github.io/tp/DevOps.html#code-coverage

    and it tells us to

    2.Once you are inside Codecov web app, add your fork to Codecov.

    Can i just clarify which fork is supposed to be added? is it the tp fork of our own group, or do we also have to add our local forks?

    I've added the fork of my tp group, as seen below. Is this sufficient?

    Hello, I am currently trying to follow the Tutorial: Removing Fields found here: https://nus-cs2103-ay2021s2.github.io/tp/tutorials/RemovingFields.html, but I am having difficult understanding the instructions, namely the line underlined below.

    What does it mean to be performing Safe Deletes on each entry?

    For instance, in the case in the screenshot, should I be trying to safe delete the parseAddress(String) method (shown below)

    Because this raises even more safe delete conflicts, and I'm not sure what to do about them

    Also, I tried to google intellij safe delete, and it said to "proceed with the appropriate action", but I am not sure what the appropriate action is supposed to be.

    Thanks for all the help everyone!

    Thank you!

    Me too.

    Is that all there is in your Duke.java? I think you'll need a Duke constructor where you define your Ui, Storage, as attributes of the Duke object (as in the example provided in the project week2 page)

    I've encountered this same issue just now. I think it is likely that you need to add the resources folder to your project classpath/source path.

    A workaround (while you are waiting for a reply/figuring out the solution) can be:

    instead of using

    private Image user = new Image(this.getClass().getResourceAsStream("/images/DaUser.png"));

    you can use

    private Image user = new Image("file:./pathToFileFromRootDirectory/DaUser.png")

    you may need to handle cross platform / or \ though if you do this.

    From what I see from reading the Checkstyle documentation, it doesn't look like its very possible unless you write? your own module for checkstyle. I don't think there's a module in checkstyle that applies specifically only to final variables.

    I suppose you could include a Regexp module to check for final variables, but it does seem quite overkill. Also, not sure how overlapping modules work.

    Anyway, I believe this is a case of where a discrepancy exists between coding standards and the given checkstyle.xml, since as you pointed out, you will violate both AbbreviationAsWordInName and MemberName if you rename the final (nonstatic) variable to SCREAMING_SNAKE_CASE. From what prof mentioned in the issue you raised previously on final variables, I believe we will not be faulted if we do not use SCREAMING_SNAKE_CASE for final (nonstatic) variables.

    @damithc for clarification

    Hi, anyone knows how to resolve this issue? Thanks in advance!

    After I merged the add-gradle-support branch, I encountered this error when running by clicking on run under application in the gradle panel.

    Screenshot 2021-02-03 at 8 10 08 PM

    Here is my file structure:

    Screenshot 2021-02-03 at 8 10 32 PM

    Did you forget to stage your changes before pushing?

    Did you push the tags to your remote repo?

    git push origin &gt;tag name>

    Thank you, guys! I have resolved the issue by updating the main class name in the build.gradle file.

    I encountered the same error before because I ran Duke instead of Launcher.

    When updating the UG of our tp, there was a build failure for the pages, but no error was given.

    How should I start to tackle this?

    Thank you for your help!

    I received this message when I was trying to submit my pull request for TP.

    I was wondering is it because my code is different from the one shown?

    I uploaded my UG for my IP onto Github, from Github I can see the images and tables just fine. However, when I access my website, the images are not shown and the table is not in format. How do I resolve this? Thanks for your help!

    Thank you!! I got it to work! Apparently the issue was my formatting of the table was not constant (i.e. some rows have | at the start and the end, some didn't) and I did not have the new line before it, for the images, the relative path solved the issue.

    Hello, perhaps you might want to leave this in at the top of your UserGuide.md?

    This worked! Thank you!

    I've blank lines in my code to improve the readability of the code and make it feel less cluttered. However, checkstyle is giving me the "Trailing Whitespace" error because of my blank lines.

    Is there any other way to remove the error without removing the blank lines?

    I checked and there were no extra white spaces before the blank lines. I tried Reformat Code but it does not solve the errors either

    There are many of the "trailing whitespace" checkstyle error messages. Here is one example with the corresponding line of code

    Error message:

    Line of code

    Oh mine is the 2nd case. How do I fix it? I tried backspacing but the blank line gets removed

    Managed to fix it on my own. Thanks a lot for the help @w2vgd !!

    taskList = storage.load();

    storage.load(taskList);

    Are both ways of loading the storage into taskList ok? Is there a better one of the two?

    I usually see code being written in the first way, but I am not really sure what the drawbacks if any of the second one are.

    Hi, can you try typing where java in your terminal. It shows the location of your current java installations in your computer. If you see more than 1 location, it might be that you are using one of your older version (java 8) to run your runtest.bat file.

    I believe that your current Java path in your environment variable is pointing to Java 8. Can you replace that path with your java 11 path (you can use the directory given in the where java command) and try to run your runtest.bat file again?

    I used enums for the commands and a switch statement in the main method. For the enum class, I used a constructor for the enum constants to give them a String value. This is so that I can relate the enum commands to the commands inputted by the user.

    e.g. TODO("todo")

    However since the commands in my main were of String type, I converted them to the enum type using a lookup method and only after that pass the commands into a switch statement.

    @chesterhow I agree, it does seem quite verbose to have additional manipulation to support the enum type. But I think some possible benefits enum could have over stacking static final constants in main is that it provides better readability, and added functionality (enum methods).

    Similar to issue #184, my group members have already made quite a few PRs/commits to the team repo master. We have made some merging back on 26 and 27 Feb (the dashboard was last updated on 28 Feb), but the team progress dashboard still isn't updated.

    Is there anything that my team might have missed out? We have did some commenting/peer reviewing, merging by another teammate, and creating PRs from a separate branch. A log of our PRs can be found here: https://github.com/AY2021S2-CS2103T-W13-2/tp/pulls?q=is%3Apr+is%3Aclosed

    Just for fun 😀

    The error message we had received:

    Run codecov/codecov-action@v1

    /bin/bash codecov.sh -n -F -Q github-action -Z -f /home/runner/work/tp/tp/build/reports/jacoco/coverage/coverage.xml


    / ____| | |

    | | ___ __| | ___ ___ _____ __

    | | / _ \ / _' |/ _ / __/ _ \ \ / /

    | || () | (| | __/ (| (_) \ V /

    ______/ _,|_|____/ _/

                              Bash-20210129-7c25fce
    

    ==> git version 2.30.0 found

    ==> curl 7.58.0 (x86_64-pc-linux-gnu) libcurl/7.58.0 OpenSSL/1.1.1i zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3

    Release-Date: 2018-01-24

    Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp

    Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL

    ==> GitHub Actions detected.

    project root: .
    
    Yaml not found, that's ok! Learn more at http://docs.codecov.io/docs/codecov-yaml
    
    -&gt; Found 1 reports
    

    ==> Detecting git/mercurial file structure

    ==> Reading reports

    + /home/runner/work/tp/tp/build/reports/jacoco/coverage/coverage.xml bytes=222022
    

    ==> Appending adjustments

    https://docs.codecov.io/docs/fixing-reports
    
    -&gt; No adjustments found
    

    ==> Gzipping contents

        16K	/tmp/codecov.NZiGxZ.gz
    

    ==> Uploading reports

    url: https://codecov.io
    
    query: branch=master&commit=e0d7187a865f195c04e10ebae7fc8eb647a257b1&build=568765456&build_url=http%3A%2F%2Fgithub.com%2FAY2021S2-CS2103T-W13-2%2Ftp%2Factions%2Fruns%2F568765456&name=&tag=&slug=AY2021S2-CS2103T-W13-2%2Ftp&service=github-actions&flags=&pr=&job=Java%20CI&cmd_args=n,F,Q,Z,f
    

    -> Pinging Codecov

    https://codecov.io/upload/v4?package=github-action-20210129-7c25fce&token=secret&branch=master&commit=e0d7187a865f195c04e10ebae7fc8eb647a257b1&build=568765456&build_url=http%3A%2F%2Fgithub.com%2FAY2021S2-CS2103T-W13-2%2Ftp%2Factions%2Fruns%2F568765456&name=&tag=&slug=AY2021S2-CS2103T-W13-2%2Ftp&service=github-actions&flags=&pr=&job=Java CI&cmd_args=n,F,Q,Z,f

    HTTP 403

    GitHub API: Forbidden

    403

    ==> Uploading to Codecov

    % Total % Received % Xferd Average Speed Time Time Time Current

                                 Dload  Upload   Total   Spent    Left  Speed
    

    0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0

    100 16029 100 31 100 15998 88 45578 --:--:-- --:--:-- --:--:-- 45666

    HTTP 403
    

    GitHub API: Forbidden

    Error: Codecov failed with the following error: The process '/bin/bash' failed with exit code 1

    Given the error involves codecov, this part of the AB3 DG may be relevant https://nus-cs2103-ay2021s2.github.io/tp/DevOps.html#code-coverage

    It's something you need to do anyway, even if it doesn't fix this problem.

    I've followed the guide and it seems to have fixed the issue. Thanks prof!

    Oh alright, thanks for your reply!

    Hi,

    Can anyone tell me how to fix this error? It pops out when I am trying to save the program to the hard disk on the second run. Writing to the file works well as shown in the first screenshot below.

    The jar file works if I run it in the same folder for my code with Intellij.

    First run

    Second run

    Thank you.

    Hi,

    Can anyone tell me how to fix this error? It pops out when I am trying to save the program to the hard disk on the second run. Writing to the file works well as shown in the first screenshot below.

    First run

    Second run

    Thank you.

    Hi, I have changed it to Launcher but the same error is still there. Why is there AccessDeniedException? It only appears when I call save() the second time.

    I'm not sure actually. My project team helped me to test out my duke.jar file and seems like it works well in Mac and Linux.

    However, the error sometimes happens on windows. I tried to run it as administrator, but it doesn't help 🙁.

    If this is the case? Should I just release my jar file?

    Thanks for your reply.


    From: Damith C. Rajapakse >notifications@github.com>

    Sent: 16 February 2021 15:34

    To: nus-cs2103-AY2021S2/forum >forum@noreply.github.com>

    Cc: Charles Lee Lin Ta >e0484321@u.nus.edu>; Mention >mention@noreply.github.com>

    Subject: Re: [nus-cs2103-AY2021S2/forum] Error when saving to hard disks (#135)

        - External Email -
    

    @CharlesLee01>https://github.com/CharlesLee01> was the issue resolved? how?

    You are receiving this because you were mentioned.

    Reply to this email directly, view it on GitHub>https://github.com/nus-cs2103-AY2021S2/forum/issues/135#issuecomment-779646333>, or unsubscribe>https://github.com/notifications/unsubscribe-auth/ASNUY366DEW6OET7YULBOBDS7INXLANCNFSM4XS6XBMA>.

    I think it works now!

    Thanks!

    Hello! It is stated that in v1.4, addition of features is not allowed, only bug fixes and editing documentation. Can I check if addition of tests are allowed? Thank you!

    Screenshot 2021-02-11 at 15 02 29

    Okay, thank you prof!

    Me too.

    Hi, did anyone face similiar issue? Not sure if I have to change the import settings on intellij ide's configuration. I used the checkstyle.xml file in addressbook-level3.

    Import statement for 'java.io.File' is in the wrong order. Should be in the 'STANDARD_JAVA_PACKAGE' group, expecting not assigned imports on this line. [CustomImportOrder]

    Here's how my imports look like at the moment.

    I used enum class for different exceptions types: E.g. INVALID_INTEGER, EMPTY_DESCRIPTION and passed them as parameters into my exception class constructors when throwing exceptions

    Place the import statements for your own classes below those from the java packages and it should be alright 😃

    Ah that worked, thanks! 😃

    @Yihe-Harry My Teammate had a similar issue. Try going to your project folder and run ./gradlew run -version. Ensure that the JVM version is 11.+. Mine looks like this.

    If it is not, it is probably because your Mac has multiple versions of Java. One easy way to fix this is to Uninstall all java versions and install java 11.

    Faced this problem, realised that gradle refuses to use the java version specified in the project settings.

    As what Gokul has mentioned, you can also check if your java version is actually defaulted to 11 in terminal.

    java -version

    I solved by doing the following:

    1. Removed all java jdks on mac

    sudo rm -rf /Library/Java/*

    1. Remove all java jdks in this folder

    Library>Java>JavaVirtualMachines

    1. Reinstall jdk11 from oracle

    2. Rebuild gradle and create jar file

    Hope this helps anyone facing the same issue!

    Hello, I noticed that ref frames as shown in the textbook have their captions placed beside the ref label in the top-left, rather than below the label. Here is a screenshot of the relevant portion of the textbook.

    However, I have searched the PlantUML language reference and searched around but cannot find out how to position the caption next to the ref label. The sources I found only show how to place it underneath. Here is a screenshot of the reference frame section of the PlantUML language reference (page 16).

    Thank you for your time.

    Assuming &gt;&gt;enumeration>> was added above Status enum name, would this then be correct? Or must the values WON and LOST also be included in an attached box below?

    The textbook (as far as I know) does not comment on this.

    Thanks.

    Hi, it seems to me that the Ui might be appropriate as an interface which can then be implemented now with a TextUI and later as a GUI. I am opening this thread for two reasons:

    1. to ask the teaching team if it is acceptable to define Ui as an interface instead of a class

    2. to get other opinions on this subject

    I considered a (possibly abstract) base class but it seems like a GUI and a text UI (TUI) might use fundamentally different mechanisms (and hence different member variables) to display stuff hence they largely only have method signatures in common. At this point, using an interface seems more appropriate than a base class. Any thoughts?

    Ah okay, thank you both.

    Hello guys, I find out that when I use gradle, the test classes that I created last week will not compile since IntelliJ can't find the package that I want to import even with I download those libraries with gradle. Any solutions?

    Hi Prof, I'm wondering whether we need to commit and tag the A-TextUiTesting to our repo because I only run the test on my laptop and there is no change of my java code? Another question is that as long as we push all the codes to our own forked repo, then will the project be regarded as done or do we need anything else?

    Hi Prof, I'm wondering whether we need to commit and tag the A-TextUiTesting to our repo because I only run the test on my laptop and there is no change of my java code?

    @skinnychenpi Files used for testing are part of the project, for example, the expected.txt, and need to committed/pushed. Otherwise anyone cloning your project will not be able to run the tests.

    Another question is that as long as we push all the codes to our own forked repo, then will the project be regarded as done or do we need anything else?

    Yes, that's all. Our scripts will pick the code from your fork.

    Thank you Prof!

    I think you are using a third-party test plugin because my dependencies section back while adding JUnit looked only like this:

    '''

    dependencies {

    testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.0'
    
    testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.5.0'
    

    }

    '''

    On a side note, have you tried reloading/reopening the project?

    Thanks for the reply, I've modified my dependencies just like you suggested. However, the compile error still exist:'error: package org.junit.jupiter.api does not exist

    import org.junit.jupiter.api.Test;'

    What constitutes the domain on inputs when considering equivalence partitions (EPs)?

    For example, lets take the following function as an example

    
    def String echo(String s) { return s; }
    
    

    Then there are probably only a few partitioning for strings of different lengths, maybe made up of different characters/encodings, etc.

    But what about things that are not strings? Do those form their on EPs? For instance, this function should throw an exception if we pass in doubles, integers, arrays, etc. Do those also count as EPs?

    In topic W3.6c about unit testing, the following skeleton is provided.

    
    class FooTest {
    
        
    
        @Test
    
        void read() {
    
            // a unit test for Foo#read() method
    
        }
    
        
    
        @Test
    
        void write_emptyInput_exceptionThrown() {
    
            // a unit tests for Foo#write(String) method
    
        }  
    
        
    
        @Test
    
        void write_normalInput_writtenCorrectly() {
    
            // another unit tests for Foo#write(String) method
    
        }
    
    }
    
    

    In the case where there isn't much set-up required for initializing Foo objects, it is trivial to instantiate a new object in each test method. However, if there is a lot of set-up involved (ie population of multiple attributes of Foo via setter methods before the object is in a minimal state for testing), then it would be tedious to repeat the process in every method.

    What would be the best practice in such a scenario? Would it be appropriate to create a method within FooTest that returns this properly instantiated Foo object or are there other best practice/conventions?

    To add on to what other people have said, IntellIJ will actually highlight the break statements as errors as well.

    Hi guys,

    I would like to check for the branches that we have in our local repository, are we allowed, or is it a good practice to delete those once the PRs are being approved by our teammates? From what I could foresee in the near future, there could be many overlapping branches that could contain outdated branches (for instance branch-Ui-Update, branch-Ui-Update1, branch-Ui1-Update) in our local repo as we further improve upon our codes and this format could vary from individuals. Would love to hear from you guys how you all approach this, thanks!

    Hi guys,

    I am not sure if I am doing the right way of running javac *.java and commiting all the .class file. I do not commit everytime I compile, only the time when I finalized with doing a task. From what I see now, it looks quite okay, but if say, we are going to implement more classes in the future, there would be too many stuffs within a certain directory. Is this considered as a 'right' way or a bad practice? What are your thoughts on this?

    Okay thanks all for your feedback. I will now close this.

    Thanks guys for the feedback!

    @tjtanjin Yea I feel that is a good POV to see from and I think it is a good idea to keep the branch for future updates, in case we need to backtrack to them for future updates / potential bugs to isolate back there.

    @damithc Okay thanks prof for the clarification 👍

    @kouyk Thanks for sharing! Yea the issue number labelling the branch certainly brings about some convenience in navigating back to the issue/feature that the branch is intended to solve.

    After I change my dialog box with SceneBuilder, this warning keeps showing up during the execution of my code.

    It does not affect my code but it keeps pop up.

    Jan 30, 2021 6:42:45 PM javafx.fxml.FXMLLoader$ValueElement processValue

    WARNING: Loading FXML document with JavaFX API of version 15.0.1 by JavaFX runtime of version 11

    Does anyone have any idea about how to fix this?

    This project was forked to my own repo and cloned to my local computer. After submited a few commits, I found that the master branch was not following me, whereas in the lecture video when prof added a new commit, the master branch was always moving upward.

    Is this normal? Am I doing anything wrong?

    Hi,

    I did try to push to my remote repo. But it keeps rejecting me.

    Looks like you committed while not on any branch (the so called 'detached head' situation)

    Try this:

    git branch temp

    git checkout master

    git merge temp

    Thank you prof, that solves my problem!

    Hi does anyone know what is causing this "validate gradle wrapper" test to fail? I have been asking around and nobody seems to experience this before. Also, none of my team members are facing this issue. This happened when I pulled the latest from the upstream repo, branched off to make changes, and then pushed the changes to create the new pull request. I have followed the URL as provided in the error message but didn't manage to fix it. Would appreciate if anyone could help, thanks!

    Hi, thank you Prof and Weiliang. I faced a similar issue and couldn't resolve it even after attempting several suggestions I found online. The proposed solution by Weiliang was straightforward and worked for me. Thanks also, for providing an explanation to what caused the issue. Cheers!

    @damithc Here is the link to the PR.

    https://github.com/AY2021S2-CS2103T-W14-2/tp/pull/55/checks?check_run_id=2084376976

    @damithc Yup that was the issue. Overlooked on the clutter within my PR. Solution as mentioned above works. After I created a new clean PR, the CI tests cleared without any issues. Thanks Prof.

    To add on, when you run the Duke.java (or your Main java file) in Intellij, the .class files are generated and stored in the bin directory. This directory is not committed because it's excluded in the .gitignore file. So you could consider adding /src/main/java/*.class to your .gitignore file to exclude the .class files.

    Hi, I think that in your build.gradle file the mainClassName should be "Launcher" instead of "Duke". Try changing this and regenerating the .jar file.

    Hi, I tried cloning your repo and running it locally (also windows) and it's working fine for me. This could mean that your system is blocking access to duke.txt after the first run for some reason.>br>

    Maybe you can refer to this post and see if it helps.

    Ui

    I would like to clarify when the instance name can be omitted in object diagrams. In the textbook, it states that if the instance name is omitted, the object instance can be interpreted as an unnamed instance. In this question, however, the Member instances are all named, yet their instance names were omitted.

    Does this mean that in UML object diagrams, the instance names are always optional, regardless of whether the instance is named or unnamed?

    After following the JavaFX tutorial part 4 and trying to run Launcher.main(), it results in a ClassNotFoundExecption in IntelliJ.

    Here is the structure of my project.

    @w2vgd that helped, thanks!

    @damithc I see, thanks for the clarification!

    How can I remove the padding from the left side and top portion of my Dialog Box although I didnt add any padding to it?

    Also, how can I display all the task in my tasklist with truncating it.

    Thanks in advance!

    Can someone help me why there's an error in importing the javafx module when i alr added it to the dependency?

    TIA!

    Hi all,

    I got this error when running the runtest.sh file.

    There's nothing we should change in the runtest.sh file right ?

    Thanks in advance !

    @w2vgd I am such an idiot. It works now thank you so much !

    I can't seem to download the executable file from CATcher3.3.7. When i download the zip file and manually npm install and start, i'm not sure how to access the cs2013T session.

    Screenshot 2021-03-22 at 3 15 54 PM

    I am getting this error when i run my tp from the main file

    java 11.0.6

    Graphics Device initialization failed for : es2, sw

    Error initializing QuantumRenderer: no suitable pipeline found

    java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found

    Anyone has a similar problem/ knows how to resolve this issue?

    I'm encountering many checkstyle errors mainly because of ordering of import statements. When i try to reorder them, intelliJ is automatically putting it back into the incorrect order. Has anyone encountered this same issue with intelliJ and knows how to resolve it?

    Does anyone know where to find the module's coding standard?

    This was covered a while ago in Week 2 readings, but it has only become a question now.

    Might there be a case where we must have a "finally" block,

    in other words, a case where we cannot just go out of the try-catch blocks?

    In other words, how is cleaning up and finishing method different?

    I've been running my code on IntelliJ, which gives rise to a bug I cannot solve. (only the 1st line includes the desired effect of "head: " appended at the front.

    On running my code in Ubuntu, after compiling and running "java Duke", the result it different; it works.

    Any idea why this happens?

    Does this mean there's something wrong with the IntelliJ terminal?

    I am running respond("hi\n" + "bye\n").

    
    public static void respond(String response) {
    
            System.out.print(Arrays.stream(response.split(System.lineSeparator())).map(line -&gt; "head: " + line).collect(Collectors.joining("\n")));
    
        }
    
    

    I'm trying to format my responses, with this method respond(String response),

    which is intended to help edit any string to the format I want, so it looks better.

    VS

    Thank you

    Thank you. Yes that seems to be the case. Hadn't noticed the descriptions when toggled.

    I will be using "\n" instead.

    From my understanding, the finally block is used for resource releasing. As in although Java has a garbage collector, there are still some classes/objects you'll have to manually close, such as files. So if you opened a file in a try block, you'll have close it in the finally block, because the finally block would execute regardless.

    Thank you for your response, I am learning new things, like about garbage collecting I had no idea was related.

    But if Im not failing to get something, I still think my question remains:

    is 'finally' block any different from putting its codes outside the try-catch block?

    i.e. why can't we just close the file outside the entire 'try-catch' block

    And to which, I think I have some idea now.

    But finally is useful for more than just exception handling — it allows the programmer to avoid having cleanup code accidentally bypassed by a return, continue, or break.

    ^ I got this from the link @georgepwhuang shared

    https://stackoverflow.com/questions/18251156/uses-of-the-finally-statement/18251196

    The name of this section should be "Reuse" instead of "API"?

    For commands consisting of only the command word and no additional input (e.g. help), the command can still be executed successfully with additional input or prefix (e.g. help n/me). Can this be considered a bug in AB3 as well as our team project?

    Library

    Commons Text

    Purpose

    Usage of LevenshteinDistance class for better search implementation

    License

    Apache License 2.0

    http://www.apache.org/licenses/

    @Yihe-Harry My Teammate had a similar issue. Try going to your project folder and run ./gradlew run -version. Ensure that the JVM version is 11.+. Mine looks like this.

    If it is not, it is probably because your Mac has multiple versions of Java. One easy way to fix this is to Uninstall all java versions and install java 11.

    @ZhangAnli Hi, Maybe you are looking for this particular commit ?

    Not sure if it’s the right way but I split my command into multiple lines!

    I copied the provided gradle.yml file into the workflows folder, as shown in this commit.

    https://github.com/ampan98/ip/commit/2d6015993b269cc71a09c2bf38f494cfcd13b57d

    However, it fails to build on GitHub Actions.

    I understand that this is a permission issue but I'm not sure how to change permissions on GitHub (or if I even need to)?

    @JQChong I tried your solution but it didn't work.

    @lirc572 this solution worked for me. Thanks for the reference also.

    Oh right that makes sense. 😐

    I faced this issue while trying to create a PR from my feature branch for a new feature just now. Here are our team repo's PRs for reference: https://github.com/AY2021S2-CS2103-T14-4/tp/pulls?q=is%3Apr+is%3Aclosed

    Basically, I created a PR to the team repo in the afternoon (#174 on our team repo), which somehow automatically merged itself into the v1.3 branch that we were working on even without passing any CI. As such, I reverted that PR (#175), and proceeded to re-create the same PR into our team repo again (#176). However from #176 onwards, the feature that I implemented disappeared, and I have not been able to make a PR because it says that no changes have occured (see pic):

    However, there are clearly different pieces of code in both repos, notably the DoTodayCommand.java file:

    v1.3 (team repo):

    daily-task-feature (forked repo):

    I don't know why this is the case. Would really appreciate if anyone could help, thanks!

    Hi @kouyk, thank you very much for the detailed explanation! It really helped to clear the confusion, and I have a better understanding of how git works now 😊

    I followed your advice and tried to revert the revert; however, my team has already merged pull requests after #175. Thus, I get this error when I try to revert it:

    Is there perhaps any way to manually perform this revert of the revert? Once again, really appreciate your help! 😃

    Thanks for all the help @kouyk! The command worked great 😃

    On Prof's most recent web lecture (29th Jan), he said the answer for quiz question 2 (commits remaining) is that all commits remain. He mentioned that git branches are like labels and if the branches have been merged, then the commits will be saved even if the branches are deleted. Could I get clarification and an explanation on this? I used to think that branches were chains of commits that only connect during branching and I thought that labels were tags.

    Thank you for the clarification and the links prof.

    Screenshot 2021-02-01 at 21 04 57

    Did anyone encounter InvocationTargetException and NullPointerException during the integration of JavaFX into the project?

    Apparently, the error happens when I entered something like "todo book" into the textbox. I suspect it is due to the first spacing of the string. When I enter "todobook" or "todobook and", the response can be returned from the DialogBox. I made a duplicate copy of the project without JavaFx and everything is working fine.

    By using the command System.getProperty("user.dir") with other different commands I found online, I could only obtain the current user.dir : "../Duke Project/src/main/java"

    However, my intended user.dir should be "../Duke Project" only and not nested all the way to the java folder inside the src folder.

    Thanks will look into it

    After adding the JavaFX to my code (the one that echoes), my main method does not exit properly even after saying bye.

    Just wanted to check if this is normal at this stage.

    The String that is supposed to print upon exiting the parser did get print, so that isn't the issue, but somehow the program does not exit even after reaching the end of the main method.

    Hi, I was cleaned up my project to attempt to get rid of some errors, so I deleted the .idea file. This required me to set up some things again on IntelliJ, like the settings under Project Structure and Edit Configurations.

    However, even after setting up everything I think I was supposed to for JavaFX, I encountered the "Cannot resolve symbol 'javafx''' error in all the files that use JavaFX.

    I've already 1) imported the libs folder from the SDK into the project, 2) added the necessary paths to the VM options in Run > Edit Configurations and 3) edited the build.gradle with the necessary dependencies. I believe that is everything that we were told to do here?

    Any idea why there are still errors?

    System.exit(0) works! Thanks so much!

    This is the error i have been getting: "Error: Main method not found in class duke.Duke, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application"

    I don't seem to know whats wrong as the app runs perfectly fine on my computer but the jar file couldn't be opened by my teammates.

    Does anyone know what should i do? Thank you!

    Hi! I have tried changing it to duke.Launcher but it still doesn't work...

    hello thank you so much for your help! it worked 😄

    I had the same issue too! For me, changing it to the location of the Launcher class in the package worked.

    I second what @w2vgd has said. break allows your program to break out of the switch block, while return allows your program to break out of the method call. Choosing one of them will do!

    For those who use SceneBuilder, here's what worked for me:

    In the DialogBox.fxml file, we can set the size of the Label element (found under Layout on the right pane) to the settings as follows. I believe this is similar to what @swayongshen has mentioned, by not fixing the height/width.

    Hi all

    I am trying to open my jar file with the following command:

    java -jar Duke.jar

    but it keeps reporting a ClassNotFoundException.

    I am wondering if any of you all have experienced similar issues, and could advise me on how to proceed.

    Thanks!

    Hi @tjtanjin

    Thanks for your help. I have tried both duke and Launcher, and for some reasons, it didn't occur to me that I needed to use duke.Launcher haha

    I was able to tun the application on IntelliJ by running Launcher.main(), and the duke image, user image and MainWindow.fxml loads normally. However, after creating the Fat Jar file using ./gradlew shadowJar, I encountered javafx.fxml.LoadException

    The full error message is attached below

    I am very confused as to why the jar file is unable to load the MainWindow.fxml and the images for Duke and User. MainWindow.fxml is stored under src/main/resources/view, and the images are stored under src/main/resources/images as per the iP guide.

    The file paths used in Main.java and MainWindow.java are as followed

    Appreciate any help or advice! Thank you:>

    Hello! Thank you and changing the extension to png worked. Do you happen to know why must .png be used? I am not sure why this will affect the loading of MainWindow.fxml

    From my perspective, this increment means we should make our code as OOP as possible. Thus I think it would be a good practice to try to refactor your code to make it fits the OOP principle more. Although during this process, you may found that FP is useful for some parts of your code and you applied FP, OOP is still the bigger idea and you can just tag it A-MoreOOP after you are done refactoring your code. Hope this helps.

    @Yihe-Harry My Teammate had a similar issue. Try going to your project folder and run ./gradlew run -version. Ensure that the JVM version is 11.+. Mine looks like this.

    If it is not, it is probably because your Mac has multiple versions of Java. One easy way to fix this is to Uninstall all java versions and install java 11.

    Faced this problem, realised that gradle refuses to use the java version specified in the project settings.

    As what Gokul has mentioned, you can also check if your java version is actually defaulted to 11 in terminal.

    java -version

    I solved by doing the following:

    1. Removed all java jdks on mac

    sudo rm -rf /Library/Java/*

    1. Remove all java jdks in this folder

    Library>Java>JavaVirtualMachines

    1. Reinstall jdk11 from oracle
    1. Rebuild gradle and create jar file

    Hope this helps anyone facing the same issue!

    Thanks a lot! I encountered the same issue and it works for me.

    Issue: The default font for AB3 does not work in Mac OS Big Sur. This is because Big Sur has stopped support the font used by AB3 "Segoe UI". Instead, gibberish will be displayed on the screen.

    Output:

    Solution:

    There are a couple of solutions to this I have found:

    1. Use a font that works in for all OS (There are a couple obvious ones such as Arial, Times New Roman, alternatively can google supported fonts for major OSes).

    2. Download and Package Segoe UI together with the tp (Need to import still).

    3. Download, Package and Use an alternative font.

    Me too.

    I thought of using enums for the commands too, but as @JonahhGohh mentioned, the commands were of String type and some additional manipulation was required before using them in a switch statement. This seems to be more verbose and tedious as compared to simply using static final constants.

    I can't help but wonder if there's any benefit to using enums in this scenario instead of constants. Any thoughts? 🤔

    Did you git push your new commits?

    References to AB3 were replaced in the UserGuide and initial changes were made but it is not being updated on the tP dashboard. Link to the User Guide shown is: https://ay2021s2-cs2103t-w13-3.github.io/tp/UserGuide.html

    Ah, thanks prof!

    Is there suppose to be data shown on the iP Progress Dashboard? I have pushed increments into my fork but the site shows [No data yet]. https://nus-cs2103-ay2021s2.github.io/dashboards/contents/ip-progress.html

    Thank you for the quick answer!

    
    On Linux, using Java 11, for the SimpleBot.jar uploaded on 02-19-2021 (MM-DD-YYYY) at 19:35:34:
    
    Graphics Device initialization failed for : es2, sw Error initializing QuantumRenderer: no suitable pipeline found 
    
    java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found at 
    
    com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280) at 
    
    com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:222) at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:260) 
    
    at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:267) at
    
    

    Hi, anyone experience a similar issue with their iP? I can't seem to reproduce the error. Any advice would be nice!

    Hi, thanks prof, I've referred to the linked issue. It has to do with the dependency resolution process in gradle.

    I am using was using the openjfx plugin to manage the jfx dependencies, but didn't realise the plugin only pulls the version specific to your distribution. Thanks so much! Will quickly update and push.

    For others that are in same predicament, please change the

    
    plugins {
    
        id 'org.openjfx.javafxplugin' version '0.0.9'
    
    }
    
    

    to individually pulling the dependencies

    
    dependencies {   
    
    ...
    
        implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win'
    
        implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac'
    
        implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'linux'
    
    ...
    
    

    To ignore it, follow the same steps you followed above when you set Git to ignore the temp.txt file.

    Referring to the image above and the quoted text, it says to follow the same steps I did to ignore an unstaged file. However, in SourceTree, upon right-clicking the ".gitignore" file, there is no option to "Ignore" the file itself.

    What is the proper way of ignoring the ".gitignore" file?

    Thank you for your clarifications!

    @tohyuting Noted, thank you!

    In sourcetree, there's an option to always create commits when merging under Tools > Options > Git.

    Thought it might help since we have a lot of branches to merge and revert to for tp 😃

    Oh my team is following the forking workflow too. When PRs are merged into the team repo, whether yours or someone else's, there are changes to pull from the team repo to your own fork's local copy. I merge these changes into my own fork's master, and into any branch that I'm working on. Correct me if this is the wrong way to do it?

    Does anyone know what causes this error and how to fix it?

    My app runs just fine when I double click the jar file, but when I do java -jar duke.jar I get this error. My friends can run it just fine when I asked them to try it though..

    Thanks in advance!

    @lirc572 yea im running it from the ubuntu terminal! I tried running it from command prompt after this and it worked! Why does it not work on ubuntu tho?

    @rajobasu I tried with and without sudo, both didn't work

    I wonder if it is just my group but the latest pushes in our project are not being reflected on reposense for a few days already.

    For e.g. all of us made PR's and merged it into master on 31st March but none of those are reflected on reposense.

    Any idea how to fix it or is it a problem with reposense not detecting them? (i doubt this is the case)

    Hi prof @damithc I just looked at the latest PRs. I think i got confused as I thought the PR's weree reflected. However, reposense shows each commit in a PR so its broken down. Thank you for the clarification! I think reposense has captured everything not to worry 😃

    Hi,

    I have merged branch-Level-8 after branch-Level-7 into the master. However, some of my Level-8 changes result in Level-7 changes to fail. Hence, after the merge commit of branch-Level-8, my code will not run due to errors. Should I still tag the merge commit of branch-Level-8 as Level-8 or should I tag the commit where I fix all the errors?

    Here is the instruction from the module website.

    Thank you!!

    Thank you @tjtanjin @litone01 @w2vgd for the help!! Will close this issue now!!

    It was mentioned that the use of other paradigms are not prohibited and if FP suits the task better, we are allowed to use it. How does this increment apply if one were to use FP instead of OOP?

    But whatever combination you come up with, you can tag it as A-MoreOOP because that's what you think the most OOP it can be.

    Thank you.

    So I am making a feature that will be making use of the list of tags and decided to follow this design. The issue comes when I want to check whether the tag is already created and then retrieve it from the list. I think Tag should not need to know about the UniqueTagList.

    With reference to how a Person is created, its uniqueness is only checked at AddCommand via a call to model.hasPerson. But at this point, Tags are already created by ParserUtil, which also does not need to know about the UniqueTagList, because the Model is outside its range of knowledge I think. So I don't really know where I should be checking for and retrieving Tags from the UniqueTagList, when Tags are created in the Parser section and only the command classes will know about the Person and model at the same time. Maybe check it at the AddCommand too, and then replace the entire Person object? Seems inefficient? Please advice on the design..

    A new Person is created at AddCommandParser and checked for its uniqueness at AddCommand, and then discarded when found to be duplicate. So I guess I can create the set of Tags and then check and add it into Person in the AddCommand..

    Hi, I had forgotten to add the description before clicking on submit. Is it possible and how should I go about adding this description if I have already submitted my review? Thank you, any help is appreciated 😄.

    I am unable to see the main comment because I did not submit one before submitting the review, so I think I am unable to add the top/main comment. Thanks for the help though, I will try to add an extra trailing comment at the end 😄.

    Nothing fancy here but a suggestion for anyone still struggling: try using ".png" files instead of ".jpg" files as images.

    It was the major problem I faced when class.getResourceAsStream() kept throwing null pointer exception saying the input stream was null when I used ".jpg" images even though it could read the ".fxml" files just fine...

    you can also checkout issue #101 to ensure full printing of longer messages, thanks to @tjtanjin for that!!

    Me too.

    Me too.

    Hi, I have encountered similar issues before, and I resolved it by adding the following lines:

    -name: Make gradlew executable

    run: chmod +x ./gradlew

    in my gradle.yml. Maybe you want to try it out?

    Edit: to clarify, you will need to place it before the lines

    - name: Build and check with Gradle

    run: ./gradlew check

    so that the changes to the permission will take effect before gradlew runs

    Library

    Jackson

    Purpose

    For serialising and de-serialising POJO.

    License

    Apache License 2.0 https://github.com/FasterXML/jackson-core/blob/master/LICENSE

    Whenever I update my automated testing files to suit the newest commits, I use the same commit name for each level - 'Update Automated UI Testing'. Is this considered confusing or generally understood?

    I have already tagged my commits before pushing them to my remote repo. All of my commits are all up on github, but in the ip progress dashboard, it says that all of my tags are not found in the fork. may I know I did something wrong or why my tags were not pushed for some reason?

    I am facing this issue whereby the fx:controller of AnchorPane in MainWindow.fxml is unable to detect the controller class that is in the Controllers package as seen in the picture above. When I hover over the error, it says class/package cannot be resolved.

    Am I navigating the package/file wrongly? Is there a specific way to use a controller?

    Thank you!

    Hi Prof, what if we implemented the extensions directly in each level so they are in the same commit?

    Initially, I thought of using enums for easy iteration as well, but it still presents the problem of poor readability ( I really don't like the long switch/if-else statements presented as we added more and more keywords ). I opted for using a HashMap instead and eventually led to using the Command Pattern presented in the book.

    A 'very good looking' basic template

    Thanks for the suggestion! However, personally, using HBox did not work for me

    I managed to get things working by adding dialog.setMinHeight(Region.USE_PREF_SIZE) in the constructor of DialogBox, as per the second answer here: https://stackoverflow.com/questions/35012518/resize-javafx-label-if-overrun

    Hi everyone! We are currently working on creating issues for our tp, and are wondering if we need to do anything with milestone v1.1.

    From what we understand, milestone v1.2 is the MVP, so our user stories should be tagged with that. In that case the already created v1.1 milestone tag will be left empty. Is there anything that we need to do with that milestone? Do we need to close or edit it?

    When using the scene builder, the FXML is generated.

    The FXML generated will violate the following coding standard

    • Imported classes should always be listed explicitly. (Generated FXML sometime use *)

    • Line length should be no longer than 120 chars. (Generated FXML does not wrap)

    Do we need to manually fix the FXML every time the scene builder generates the FXML to meet the java coding standard?

    Suppose I'm trying to modify elements of the GUI and hence requires access to some property in UIManager. The current state of AB3 doesn't seem to be able to allow access to said property from a Model object, which is modified when a Command is executed. One way I was able to circumvent this issue is to use a third class to store a reference to the property I need and then accessing it from that third class whenever I need it.

    The introduction of this third class seem to be introducing cyclic dependencies into this program. Assuming I can properly test this new feature, document it, and ensure it does not affect any other features being added, will I still be marked down for this?

    Library

    FuzzyWuzzy

    Purpose

    Fuzzy string matching for string searches

    License

    GPL-2.0 License

    LICENCE

    You can find the file here: https://github.com/se-edu/addressbook-level3/tree/master/config/checkstyle

    Don't give up!

    I think you need to put 2 lines

    import duke.exception.DukeException;

    import duke.ui.Ui;

    to the bottom of the import list

    Hi, "Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. They're kind of like email—except they can be shared and discussed with the rest of your team. Most software projects have a bug tracker of some kind. GitHub's tracker is called Issues, and has its own section in every repository."

    Since no one reported a bug or found any issues in your code so it is totally fine that is empty.

    Same issue here.